From d9ad0e9a8fbf6cc109f26f08d8b23405985fe9ed Mon Sep 17 00:00:00 2001 From: sambas Date: Sun, 27 Feb 2011 19:03:58 +0000 Subject: [PATCH] OP-22 Flight/PiOS: Spektrum hacks, doubled supervisor timer and ?loss? counter to the channel8 value git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2907 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/PiOS/STM32F10x/pios_spektrum.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flight/PiOS/STM32F10x/pios_spektrum.c b/flight/PiOS/STM32F10x/pios_spektrum.c index 0562ba732..ecff7cf1e 100644 --- a/flight/PiOS/STM32F10x/pios_spektrum.c +++ b/flight/PiOS/STM32F10x/pios_spektrum.c @@ -195,6 +195,13 @@ int32_t PIOS_SPEKTRUM_Decode(uint8_t b) bytecount++; if (sync == 0) { sync_word = (prev_byte << 8) + b; + if(bytecount==1) + { + /* record losscounter into channel8 */ + CaptureValueTemp[7]=b; + /* instant write */ + CaptureValue[7]=b; + } if (((sync_word & 0x00FE) == 0) && (bytecount == 2)) { /* sync low byte always 0x01, high byte seems to be random when switching TX on off on, loss counter??? */ if (sync_word & 0x01) { @@ -271,7 +278,7 @@ void PIOS_SPEKTRUM_irq_handler() { frame_error=0; sync_of++; /* watchdog activated */ - if (sync_of > 3) { + if (sync_of > 6) { /* signal lost */ sync_of = 0; for (int i = 0; i < 12; i++)