WIP: THt Timer option
Hi Mike
I have been trying to implement Opentx THt functionality in ersky9x. (As a reminder, THt is a timer that starts on first throttle push and unlike THs, does not stop when throttle is pulled down.)
So far the code works on 9XR PRO (english only), unless there is a throttle warning. I have tried to include a resetTimer(); after the call to checkTHR(); but it doesn't seem to work.
If you have the time, any hint will be appreciated.
mentero@momo ~ $ diff ~/Desktop/mbtx-mentero/radio/ersky9x/src ~/Desktop/remotegitmbtx/mbtx/radio/ersky9x/src
diff /home/mentero/Desktop/mbtx-mentero/radio/ersky9x/src/en.h /home/mentero/Desktop/remotegitmbtx/mbtx/radio/ersky9x/src/en.h
468,469c468
< //#define ISTR_TRIGA_OPTS "OFFON THsTH%"
< #define ISTR_TRIGA_OPTS "OFFON THtTHsTH%"
---
> #define ISTR_TRIGA_OPTS "OFFON THsTH%"
diff /home/mentero/Desktop/mbtx-mentero/radio/ersky9x/src/ersky9x.h /home/mentero/Desktop/remotegitmbtx/mbtx/radio/ersky9x/src/ersky9x.h
724c724
< #define TMR_VAROFS 5
---
> #define TMR_VAROFS 4
728,731c728,729
< #define TMRMODE_THR_THT 2
< #define TMRMODE_THR_THS 3
< #define TMRMODE_THR_REL 4
<
---
> #define TMRMODE_THR 2
> #define TMRMODE_THR_REL 3
diff /home/mentero/Desktop/mbtx-mentero/radio/ersky9x/src/menus.cpp /home/mentero/Desktop/remotegitmbtx/mbtx/radio/ersky9x/src/menus.cpp
11344d11343
< // THt AND switch/switchm - both throttle stick AND switch
11486,11489c11485
< //if(val) ptimer->s_timeCumThr += 1;
< if ((tma == TMRMODE_THR_THT) && (val || ptimer->s_timeCumThr)) ptimer->s_timeCumThr += 1; // THt does not stop when throttle down once triggered.
< if ((tma != TMRMODE_THR_THT) && val) ptimer->s_timeCumThr += 1;//THs
<
---
> if(val) ptimer->s_timeCumThr += 1;
diff /home/mentero/Desktop/mbtx-mentero/radio/ersky9x/src/mixer.cpp /home/mentero/Desktop/remotegitmbtx/mbtx/radio/ersky9x/src/mixer.cpp
72c72
< //now OFFON THtTHsTH%
---
> //now OFFABSTHsTH%
diff /home/mentero/Desktop/mbtx-mentero/radio/ersky9x/src/sam3s8c_flash.ld /home/mentero/Desktop/remotegitmbtx/mbtx/radio/ersky9x/src/sam3s8c_flash.ld
170d169
< *(.eh_frame)
mentero@momo ~ $
Quick comments: Changing "ISTR_TRIGA_OPTS" in this way will cause any existing setting of users using "THsTH%" or "cx%" to become incorrect. I always try to avoid this happening.
The function may be obtained by using two logical switches: L1: v>val Thr -98 L2: Latch L1 TRN (where TRN is a switch to stop the timer) Then just set TriggerA to ON and TriggerB to L2
I'll try to examine your code more closely, just need some time to do so!
Right, inserting options in the middle of "ISTR_TRIGA_OPTS" will change the existing settings. If I ever get the thing to work, I'll try to find a different solution, (without putting the option at the end of the menu).
Also true that the Logical switches work as expected, but I find much more intuitive having the option in the timers menu, and I am used to that. In fact, on my radio firmware compiled "at home" I have simply eliminated THs and installed THt.
This is a minor (and probably only mine) issue, I understand if you can't find the time, since I also understand you have a lot of code and many platforms to maintain. ;-) Thanks anyway