Mixer slow bug (source=MAX, switch, slow up, no slow down)

This commit is contained in:
bsongis
2014-02-26 21:19:47 +01:00
parent 86c0678273
commit fdd2e3f4d4
2 changed files with 33 additions and 6 deletions
+31 -5
View File
@@ -91,8 +91,6 @@ TEST(Trims, infiniteChainedTrims)
TEST(outdezNAtt, test_unsigned)
{
uint16_t altitude = 65530;
uint8_t refBuf[sizeof(displayBuf)];
memset(displayBuf, 0, sizeof(displayBuf));
lcd_putc(0*FWNUM, 0, '6');
@@ -103,12 +101,12 @@ TEST(outdezNAtt, test_unsigned)
memcpy(refBuf, displayBuf, sizeof(displayBuf));
memset(displayBuf, 0, sizeof(displayBuf));
lcd_outdezNAtt(1, 0, altitude, LEFT|UNSIGN);
lcd_outdezNAtt(0, 0, 65530, LEFT|UNSIGN);
EXPECT_EQ(memcmp(refBuf, displayBuf, sizeof(displayBuf)), 0) << "Unsigned numbers will be bad displayed";
}
TEST(EEPROM, 1000_random_writes)
TEST(EEPROM, 100_random_writes)
{
eepromFile = NULL; // in memory
RlcFile f;
@@ -117,7 +115,7 @@ TEST(EEPROM, 1000_random_writes)
EeFsFormat();
for(int i=0; i<1000; i++) {
for(int i=0; i<100; i++) {
int size = rand()%800;
for(int j=0; j<size; j++) {
buf[j] = rand() < (RAND_MAX/10000*i) ? 0 : (j&0xff);
@@ -580,6 +578,34 @@ TEST(Mixer, SlowOnSwitch)
CHECK_SLOW_MOVEMENT(0, -1, 250);
}
TEST(Mixer, SlowUpOnSwitch)
{
MODEL_RESET();
MIXER_RESET();
g_model.mixData[0].destCh = 0;
g_model.mixData[0].mltpx = MLTPX_ADD;
g_model.mixData[0].srcRaw = MIXSRC_MAX;
g_model.mixData[0].weight = 100;
g_model.mixData[0].swtch = SWSRC_THR;
g_model.mixData[0].speedUp = 10;
g_model.mixData[0].speedDown = 0;
simuSetSwitch(0, 0);
perOut(e_perout_mode_normal, 0);
EXPECT_EQ(chans[0], 0);
simuSetSwitch(0, 1);
CHECK_SLOW_MOVEMENT(0, +1, 250);
simuSetSwitch(0, 0);
perOut(e_perout_mode_normal, 1);
EXPECT_EQ(chans[0], 0);
lastAct = 0;
simuSetSwitch(0, 1);
CHECK_SLOW_MOVEMENT(0, +1, 100);
}
TEST(Mixer, SlowOnPhase)
{
MODEL_RESET();
+2 -1
View File
@@ -3780,7 +3780,7 @@ void perOut(uint8_t mode, uint8_t tick10ms)
continue;
}
else if (!mixEnabled) {
if (md->speedDown && md->mltpx!=MLTPX_REP) {
if ((md->speedDown || md->speedUp) && md->mltpx!=MLTPX_REP) {
if (mixCondition) {
v = (md->mltpx == MLTPX_ADD ? 0 : RESX);
apply_offset_and_curve = false;
@@ -3825,6 +3825,7 @@ void perOut(uint8_t mode, uint8_t tick10ms)
//========== SPEED ===============
// now its on input side, but without weight compensation. More like other remote controls
// lower weight causes slower movement
if (mode <= e_perout_mode_inactive_phase && (md->speedUp || md->speedDown)) { // there are delay values
#define DEL_MULT_SHIFT 8
// we recale to a mult 256 higher value for calculation