Small fix for Mix delays when the switch is toggled before the delay is expired

Test code for Franck (have a look to open9x.cpp, in the first lines)
This commit is contained in:
bsongis
2012-08-13 07:49:56 +00:00
parent 0f5e855849
commit 8c5dd2b0d9
3 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -1141,7 +1141,7 @@ uint32_t txPdcPending()
pUsart->US_PTCR = US_PTCR_TXTDIS ; // Freeze DMA
x = pUsart->US_TNCR ; // Total
x += pUsart->US_TCR ; // Still to send
pUsart->US_PTCR = US_PTCR_TXTEN ; // DMA active again
pUsart->US_PTCR = US_PTCR_TXTEN ; // DMA active again
__enable_irq() ;
return x ;
+1 -1
View File
@@ -1202,7 +1202,7 @@ void menuProcFrsky(uint8_t event)
}
}
if (fields_count == 0) {
// No bars at all!
// No custom fields at all!
putEvent(event == EVT_KEY_BREAK(KEY_UP) ? event : EVT_KEY_BREAK(KEY_DOWN));
}
lcd_status_line();
+14 -4
View File
@@ -31,6 +31,8 @@
*
*/
// Here Franck you write this line "#define FRANCK" (without the "")
#if defined(PCBARM) && !defined(SIMU)
extern "C" {
#include <CoOS.h>
@@ -478,9 +480,11 @@ int16_t applyLimits(uint8_t channel, int32_t value)
if (ofs > lim_p) ofs = lim_p;
if (ofs < lim_n) ofs = lim_n;
#ifndef FRANCK
if (value) value =
(value > 0) ? value * ((int32_t) lim_p - ofs) / 100000 :
-value * ((int32_t) lim_n - ofs) / 100000; //div by 100000 -> output = -1024..1024
#endif
value += calc1000toRESX(ofs);
lim_p = calc1000toRESX(lim_p);
@@ -2052,7 +2056,10 @@ void perOut(uint8_t tick10ms)
swOn[i] = true;
if (md->delayUp) {
if (swTog) {
sDelay[i] = md->delayUp * 50;
if (sDelay[i])
sDelay[i] = 0;
else
sDelay[i] = md->delayUp * 50;
}
if (sDelay[i] > 0) { // perform delay
sDelay[i] -= tick10ms;
@@ -2073,7 +2080,10 @@ void perOut(uint8_t tick10ms)
swOn[i] = false;
if (md->delayDown) {
if (swTog) {
sDelay[i] = md->delayDown * 50;
if (sDelay[i])
sDelay[i] = 0;
else
sDelay[i] = md->delayDown * 50;
}
if (sDelay[i] > 0) { // perform delay
sDelay[i] -= tick10ms;
@@ -3661,11 +3671,11 @@ int main(void)
sei(); // interrupts needed for FRSKY_Init and eeReadAll.
#if defined (FRSKY) and !defined (DSM2_SERIAL)
#if defined(FRSKY) and !defined(DSM2_SERIAL)
FRSKY_Init();
#endif
#if defined (DSM2_SERIAL) and !defined (FRSKY)
#if defined(DSM2_SERIAL) and !defined(FRSKY)
DSM2_Init();
#endif