mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 23:35:17 +03:00
Work on timers and the trace function.
The timer2 should be full featured now. Markers around the splash.
This commit is contained in:
parent
e96b9d410e
commit
40d36bb0c5
9 changed files with 169 additions and 166 deletions
235
src/gruvin9x.cpp
235
src/gruvin9x.cpp
|
@ -20,7 +20,11 @@
|
|||
*/
|
||||
|
||||
#include "gruvin9x.h"
|
||||
|
||||
prog_uchar APM spsMarker[] = { "SPS" };
|
||||
#include "s9xsplash.lbm"
|
||||
prog_uchar APM speMarker[] = { "SPE" };
|
||||
|
||||
#include "menus.h"
|
||||
|
||||
// MM/SD card Disk IO Support
|
||||
|
@ -480,7 +484,7 @@ uint8_t keyDown()
|
|||
return (in);
|
||||
}
|
||||
#else
|
||||
inline uint8_t keyDown()
|
||||
FORCEINLINE uint8_t keyDown()
|
||||
{
|
||||
#if defined (PCBV4)
|
||||
return (~PINL) & 0x3F;
|
||||
|
@ -883,7 +887,7 @@ uint8_t beepAgain = 0;
|
|||
uint8_t beepAgainOrig = 0;
|
||||
uint8_t beepOn = false;
|
||||
|
||||
inline bool checkSlaveMode()
|
||||
FORCEINLINE bool checkSlaveMode()
|
||||
{
|
||||
// no power -> only phone jack = slave mode
|
||||
|
||||
|
@ -906,177 +910,179 @@ inline bool checkSlaveMode()
|
|||
}
|
||||
|
||||
uint16_t s_timeCumTot;
|
||||
uint16_t s_timeCumAbs; //laufzeit in 1/16 sec
|
||||
uint16_t s_timeCumSw; //laufzeit in 1/16 sec
|
||||
uint16_t s_timeCumThr; //gewichtete laufzeit in 1/16 sec
|
||||
uint16_t s_timeCum16ThrP; //gewichtete laufzeit in 1/16 sec
|
||||
|
||||
uint8_t s_timerState;
|
||||
uint16_t s_timeCumThr; // THR in 1/16 sec
|
||||
uint16_t s_timeCum16ThrP; // THR% in 1/16 sec
|
||||
uint8_t s_timerState[2];
|
||||
int16_t s_timerVal[2];
|
||||
uint8_t Timer1_pre = 0 ;
|
||||
|
||||
uint8_t Timer2_running = 0 ;
|
||||
uint8_t Timer2_pre = 0 ;
|
||||
uint16_t timer2 = 0 ;
|
||||
uint8_t s_timerVal_10ms[2] = {0, 0};
|
||||
|
||||
uint8_t trimsCheckTimer = 0;
|
||||
|
||||
void resetTimer1()
|
||||
void resetTimer(uint8_t idx)
|
||||
{
|
||||
s_timerState = TMR_OFF; // is changed to RUNNING dep from mode
|
||||
s_timeCumAbs=0;
|
||||
s_timeCumThr=0;
|
||||
s_timeCumSw=0;
|
||||
s_timeCum16ThrP=0;
|
||||
Timer1_pre = 0 ;
|
||||
s_timerState[idx] = TMR_OFF; // is changed to RUNNING dep from mode
|
||||
s_timerVal[idx] = (idx == 0 ? g_model.timer1.val : g_model.timer2.val);
|
||||
s_timerVal_10ms[idx] = 0 ;
|
||||
}
|
||||
|
||||
void resetTimer2()
|
||||
FORCEINLINE void incTimers()
|
||||
{
|
||||
Timer2_pre = 0 ;
|
||||
timer2 = 0 ;
|
||||
}
|
||||
static uint8_t lastSwPos[2] = {0, 0};
|
||||
static uint16_t s_cnt[2] = {0, 0};
|
||||
static uint16_t s_sum[2] = {0, 0};
|
||||
static uint8_t sw_toggled[2] = {false, false};
|
||||
static uint16_t s_time_cum_16[2] = {0, 0};
|
||||
|
||||
inline void incTimers()
|
||||
{
|
||||
TimerData *timer = &g_model.timer1;
|
||||
|
||||
for (uint8_t i=0; i<1; i++, timer=&g_model.timer2) {
|
||||
for (uint8_t i=0; i<2; i++, timer=&g_model.timer2) {
|
||||
int8_t tm = timer->mode;
|
||||
|
||||
if (!tm)
|
||||
continue;
|
||||
|
||||
if (s_timerState[i] == TMR_OFF) {
|
||||
s_timerState[i] = TMR_RUNNING;
|
||||
s_cnt[i] = 0;
|
||||
s_sum[i] = 0;
|
||||
s_time_cum_16[i] = 0;
|
||||
}
|
||||
|
||||
uint8_t atm = abs(tm);
|
||||
|
||||
// value for time described in timer->mode
|
||||
// OFFABSRUsRU%ELsEL%THsTH%ALsAL%P1P1%P2P2%P3P3%
|
||||
uint16_t val = 0;
|
||||
int16_t val = 0;
|
||||
if (atm>1 && atm<TMR_VAROFS) {
|
||||
val = calibratedStick[CONVERT_MODE(atm/2)-1];
|
||||
val = (tm<0 ? RESX-val : val+RESX ) / (RESX/16);
|
||||
s_cnt[i]++;
|
||||
s_sum[i]+=val;
|
||||
}
|
||||
|
||||
static uint16_t s_time;
|
||||
static uint16_t s_cnt;
|
||||
static uint16_t s_sum;
|
||||
static uint8_t sw_toggled[2] = {false, false};
|
||||
|
||||
if (atm>=(TMR_VAROFS+MAX_SWITCH-1)){ // toggeled switch
|
||||
static uint8_t lastSwPos[2] = {0, 0};
|
||||
if(!(sw_toggled[i] | s_sum | s_cnt | s_time | lastSwPos[i])) lastSwPos[i] = tm < 0; // if initializing then init the lastSwPos
|
||||
if(!(sw_toggled[i] | s_sum[i] | s_cnt[i] | lastSwPos[i])) lastSwPos[i] = tm < 0; // if initializing then init the lastSwPos
|
||||
uint8_t swPos = getSwitch(tm>0 ? tm-(TMR_VAROFS+MAX_SWITCH-1-1) : tm+(TMR_VAROFS+MAX_SWITCH-1-1), 0);
|
||||
if (swPos && !lastSwPos[i]) sw_toggled[i] = !sw_toggled[i]; // if switch is flipped first time -> change counter state
|
||||
lastSwPos[i] = swPos;
|
||||
}
|
||||
|
||||
s_cnt++;
|
||||
s_sum+=val;
|
||||
if ( (s_timerVal_10ms[i] += 1 ) >= 100 ) {
|
||||
s_timerVal_10ms[i] -= 100 ;
|
||||
|
||||
if ( (Timer1_pre += 1 ) >= 100 ) {
|
||||
Timer1_pre -= 100 ;
|
||||
s_time += 100;
|
||||
val = s_sum/s_cnt;
|
||||
s_sum -= val*s_cnt; //rest
|
||||
s_cnt = 0;
|
||||
if (timer->val) s_timerVal[0] = timer->val - s_timerVal[0];
|
||||
|
||||
if (atm<TMR_VAROFS)
|
||||
sw_toggled[i] = false; // not switch - sw timer off
|
||||
else if (atm<(TMR_VAROFS+MAX_SWITCH-1))
|
||||
if (atm==TMRMODE_ABS) {
|
||||
s_timerVal[i]++;
|
||||
}
|
||||
else if (atm<TMR_VAROFS) {
|
||||
if (atm&1) {
|
||||
if (s_cnt[i]) {
|
||||
val = s_sum[i]/s_cnt[i];
|
||||
s_sum[i] -= val*s_cnt[i]; //rest
|
||||
s_cnt[i] = 0;
|
||||
s_time_cum_16[i] += val/2;
|
||||
if (s_time_cum_16[i] >= 16) {
|
||||
s_timerVal[i] ++;
|
||||
s_time_cum_16[i] -= 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (val) {
|
||||
s_timerVal[i]++;
|
||||
}
|
||||
}
|
||||
else if (atm<(TMR_VAROFS+MAX_SWITCH-1)) {
|
||||
sw_toggled[i] = getSwitch((tm>0 ? tm-(TMR_VAROFS-1) : tm+(TMR_VAROFS-1)), 0); // normal switch
|
||||
}
|
||||
|
||||
s_timeCumTot += 1;
|
||||
s_timeCumAbs += 1;
|
||||
if(val) s_timeCumThr += 1;
|
||||
if(sw_toggled) s_timeCumSw += 1;
|
||||
s_timeCum16ThrP += val/2;
|
||||
|
||||
s_timerVal[i] = timer->val;
|
||||
if (atm==TMRMODE_NONE) s_timerState = TMR_OFF;
|
||||
else if (atm==TMRMODE_ABS) s_timerVal[i] -= s_timeCumAbs;
|
||||
else if(atm<TMR_VAROFS) s_timerVal[i] -= (atm&1) ? s_timeCum16ThrP/16 : s_timeCumThr;// stick% : stick
|
||||
else s_timerVal[i] -= s_timeCumSw; //switch
|
||||
|
||||
switch(s_timerState)
|
||||
switch(s_timerState[i])
|
||||
{
|
||||
case TMR_OFF:
|
||||
if (tm != TMRMODE_NONE) s_timerState=TMR_RUNNING;
|
||||
break;
|
||||
case TMR_RUNNING:
|
||||
if (s_timerVal[i]<=0 && timer->val) s_timerState=TMR_BEEPING;
|
||||
if (timer->val && s_timerVal[i]>=timer->val) s_timerState[i]=TMR_BEEPING;
|
||||
break;
|
||||
case TMR_BEEPING:
|
||||
if (s_timerVal[i] <= -MAX_ALERT_TIME) s_timerState=TMR_STOPPED;
|
||||
if (timer->val == 0) s_timerState=TMR_RUNNING;
|
||||
break;
|
||||
case TMR_STOPPED:
|
||||
if (s_timerVal[i] >= timer->val + MAX_ALERT_TIME) s_timerState[i]=TMR_STOPPED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (timer->val) s_timerVal[0] = timer->val - s_timerVal[0]; //if counting backwards - display backwards
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t last_tmr;
|
||||
if (last_tmr != s_timerVal[0]) { // beep only if seconds advance
|
||||
if (s_timerState[0] == TMR_RUNNING) {
|
||||
if (g_eeGeneral.preBeep && g_model.timer1.val) { // beep when 30, 15, 10, 5,4,3,2,1 seconds remaining
|
||||
if(s_timerVal[0]==30) {beepAgain=2; beepWarn2();} //beep three times
|
||||
if(s_timerVal[0]==20) {beepAgain=1; beepWarn2();} //beep two times
|
||||
if(s_timerVal[0]==10) beepWarn2();
|
||||
if(s_timerVal[0]<= 3) beepWarn2();
|
||||
|
||||
if (last_tmr != s_timerVal[i]) //beep only if seconds advance
|
||||
{
|
||||
if(s_timerState==TMR_RUNNING)
|
||||
{
|
||||
if(g_eeGeneral.preBeep && timer->val) // beep when 30, 15, 10, 5,4,3,2,1 seconds remaining
|
||||
{
|
||||
if(s_timerVal[i]==30) {beepAgain=2; beepWarn2();} //beep three times
|
||||
if(s_timerVal[i]==20) {beepAgain=1; beepWarn2();} //beep two times
|
||||
if(s_timerVal[i]==10) beepWarn2();
|
||||
if(s_timerVal[i]<= 3) beepWarn2();
|
||||
|
||||
if(g_eeGeneral.flashBeep && (s_timerVal[i]==30 || s_timerVal[i]==20 || s_timerVal[i]==10 || s_timerVal[i]<=3))
|
||||
if(g_eeGeneral.flashBeep && (s_timerVal[0]==30 || s_timerVal[0]==20 || s_timerVal[0]==10 || s_timerVal[0]<=3))
|
||||
g_LightOffCounter = FLASH_DURATION;
|
||||
}
|
||||
|
||||
if(g_eeGeneral.minuteBeep && (((timer->dir ? timer->val-s_timerVal[i] : s_timerVal[i])%60)==0)) //short beep every minute
|
||||
{
|
||||
if (g_eeGeneral.minuteBeep && (((timer->val ? timer->val-s_timerVal[0] : s_timerVal[0])%60)==0)) { // short beep every minute
|
||||
beepWarn2();
|
||||
if(g_eeGeneral.flashBeep) g_LightOffCounter = FLASH_DURATION;
|
||||
}
|
||||
}
|
||||
else if(s_timerState==TMR_BEEPING)
|
||||
else if(s_timerState[0] == TMR_BEEPING)
|
||||
{
|
||||
beepWarn();
|
||||
if(g_eeGeneral.flashBeep) g_LightOffCounter = FLASH_DURATION;
|
||||
}
|
||||
}
|
||||
last_tmr = s_timerVal[i];
|
||||
if(timer->dir) s_timerVal[i] = timer->val-s_timerVal[i]; //if counting backwards - display backwards
|
||||
}
|
||||
}
|
||||
|
||||
if (Timer2_running) {
|
||||
if ( (Timer2_pre += 1 ) >= 100 ) {
|
||||
Timer2_pre -= 100 ;
|
||||
timer2 += 1 ;
|
||||
}
|
||||
last_tmr = s_timerVal[0];
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t s_traceBuf[MAXTRACE];
|
||||
uint16_t s_traceWr;
|
||||
uint16_t s_traceCnt;
|
||||
inline void trace() // called in perOut - once envery 0.01sec
|
||||
int8_t s_traceCnt;
|
||||
FORCEINLINE void thrTrace() // called in perOut - once envery 0.01sec
|
||||
{
|
||||
incTimers();
|
||||
|
||||
uint16_t val = calibratedStick[CONVERT_MODE(3)-1]; // get throttle channel value
|
||||
int16_t val = calibratedStick[CONVERT_MODE(3)-1]; // get throttle channel value
|
||||
val = (g_eeGeneral.throttleReversed ? RESX-val : val+RESX);
|
||||
val /= (RESX/16); // calibrate it
|
||||
|
||||
static uint16_t s_time;
|
||||
static uint16_t s_cnt;
|
||||
static uint16_t s_sum;
|
||||
s_cnt++;
|
||||
s_sum+=val;
|
||||
if((get_tmr10ms()-s_time)<1000) //10 sec
|
||||
return;
|
||||
s_time= get_tmr10ms();
|
||||
val = s_sum/s_cnt;
|
||||
s_sum = 0;
|
||||
s_cnt = 0;
|
||||
static uint16_t s_time_tot;
|
||||
static uint16_t s_time_trace;
|
||||
static uint8_t s_cnt_1s;
|
||||
static uint16_t s_sum_1s;
|
||||
static uint16_t s_cnt_10s;
|
||||
static uint16_t s_sum_10s;
|
||||
|
||||
s_cnt_1s ++;
|
||||
s_sum_1s +=val;
|
||||
|
||||
uint16_t tmr10ms = get_tmr10ms();
|
||||
if (tmr10ms - s_time_tot < 100) // 1sec
|
||||
return;
|
||||
|
||||
s_time_tot += 100;
|
||||
s_timeCumTot += 1;
|
||||
|
||||
val = s_sum_1s / s_cnt_1s;
|
||||
s_timeCum16ThrP += val/2;
|
||||
if (val) s_timeCumThr += 1;
|
||||
|
||||
s_cnt_10s += s_cnt_1s;
|
||||
s_sum_10s += s_sum_1s;
|
||||
s_cnt_1s = 0;
|
||||
s_sum_1s = 0;
|
||||
|
||||
if (tmr10ms - s_time_trace < 1000) // 10sec
|
||||
return;
|
||||
|
||||
s_time_trace += 1000;
|
||||
val = s_sum_10s/s_cnt_10s;
|
||||
s_sum_10s = 0;
|
||||
s_cnt_10s = 0;
|
||||
|
||||
s_traceCnt++;
|
||||
s_traceBuf[s_traceWr++] = val;
|
||||
if(s_traceWr>=MAXTRACE) s_traceWr=0;
|
||||
if (s_traceWr >= MAXTRACE) s_traceWr=0;
|
||||
if (s_traceCnt >= 0) s_traceCnt++;
|
||||
}
|
||||
|
||||
#ifdef HELI
|
||||
|
@ -1109,7 +1115,7 @@ int32_t act [MAX_MIXERS] = {0};
|
|||
uint8_t swOn [MAX_MIXERS] = {0};
|
||||
uint8_t mixWarning;
|
||||
|
||||
inline void evalTrims(uint8_t phase)
|
||||
FORCEINLINE void evalTrims(uint8_t phase)
|
||||
{
|
||||
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
||||
// do trim -> throttle trim if applicable
|
||||
|
@ -1312,7 +1318,10 @@ void perOut(int16_t *chanOut, uint8_t phase)
|
|||
|
||||
for (uint8_t i=CHOUT_BASE; i<NUM_XCHNRAW; i++) anas[i] = chans[i-CHOUT_BASE]; // other mixes previous outputs
|
||||
|
||||
if(tick10ms) trace(); //trace thr 0..32 (/32)
|
||||
if (tick10ms) {
|
||||
incTimers();
|
||||
thrTrace(); // trace thr 0..32 (/32)
|
||||
}
|
||||
|
||||
memset(chans,0,sizeof(chans)); // All outputs to 0
|
||||
|
||||
|
|
|
@ -488,12 +488,11 @@ extern int16_t getTrimValue(uint8_t phase, uint8_t idx);
|
|||
extern void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim);
|
||||
|
||||
extern uint16_t s_timeCumTot;
|
||||
extern uint16_t s_timeCumAbs; //laufzeit in 1/16 sec
|
||||
extern uint16_t s_timeCumSw; //laufzeit in 1/16 sec
|
||||
extern uint16_t s_timeCumThr; //gewichtete laufzeit in 1/16 sec
|
||||
extern uint16_t s_timeCum16ThrP; //gewichtete laufzeit in 1/16 sec
|
||||
extern uint8_t s_timerState;
|
||||
extern uint8_t s_timerState[2];
|
||||
extern int16_t s_timerVal[2];
|
||||
extern uint8_t s_timerVal_10ms[2];
|
||||
|
||||
extern uint8_t trimsCheckTimer;
|
||||
|
||||
|
@ -501,11 +500,7 @@ extern uint8_t trimsCheckTimer;
|
|||
#define TMR_RUNNING 1
|
||||
#define TMR_BEEPING 2
|
||||
#define TMR_STOPPED 3
|
||||
void resetTimer1();
|
||||
|
||||
extern uint8_t Timer2_running ;
|
||||
extern uint16_t timer2 ;
|
||||
void resetTimer2() ;
|
||||
void resetTimer(uint8_t idx);
|
||||
|
||||
extern uint8_t g_tmr1Latency_max;
|
||||
extern uint8_t g_tmr1Latency_min;
|
||||
|
@ -515,7 +510,7 @@ extern uint16_t g_time_per10;
|
|||
#define MAXTRACE 120
|
||||
extern uint8_t s_traceBuf[MAXTRACE];
|
||||
extern uint16_t s_traceWr;
|
||||
extern uint16_t s_traceCnt;
|
||||
extern int8_t s_traceCnt;
|
||||
|
||||
uint16_t getTmr16KHz();
|
||||
uint16_t stack_free();
|
||||
|
|
|
@ -81,6 +81,7 @@ void doMainScreenGrphics()
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
void displayAltitudeLine(uint8_t x, uint8_t y, uint8_t flags)
|
||||
{
|
||||
lcd_puts_P(x, y, PSTR("Alt:"));
|
||||
|
@ -88,6 +89,7 @@ void displayAltitudeLine(uint8_t x, uint8_t y, uint8_t flags)
|
|||
lcd_outdezAtt(lcd_lastPos, (flags & DBLSIZE) ? y-FH : y, value, flags|LEFT|UNSIGN);
|
||||
lcd_putc(lcd_lastPos, y, 'm') ;
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuMainView(uint8_t event)
|
||||
{
|
||||
|
@ -101,7 +103,7 @@ void menuMainView(uint8_t event)
|
|||
{
|
||||
case EVT_KEY_BREAK(KEY_MENU):
|
||||
if (view_base == e_timer2) {
|
||||
Timer2_running = !Timer2_running;
|
||||
// TODO Timer2_running = !Timer2_running;
|
||||
beepKey();
|
||||
}
|
||||
break;
|
||||
|
@ -160,11 +162,11 @@ void menuMainView(uint8_t event)
|
|||
killEvents(event);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
if(s_timerState==TMR_BEEPING) {
|
||||
s_timerState = TMR_STOPPED;
|
||||
if(s_timerState[0]==TMR_BEEPING) {
|
||||
s_timerState[0] = TMR_STOPPED;
|
||||
}
|
||||
else if (view == e_timer2) {
|
||||
resetTimer2();
|
||||
resetTimer(1);
|
||||
}
|
||||
#ifdef FRSKY
|
||||
else if (view_base == e_telemetry) {
|
||||
|
@ -172,13 +174,13 @@ void menuMainView(uint8_t event)
|
|||
}
|
||||
#endif
|
||||
else {
|
||||
resetTimer1();
|
||||
resetTimer(0);
|
||||
}
|
||||
beepKey();
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
resetTimer1();
|
||||
resetTimer2();
|
||||
resetTimer(0);
|
||||
resetTimer(1);
|
||||
#ifdef FRSKY
|
||||
resetTelemetry();
|
||||
#endif
|
||||
|
@ -206,8 +208,8 @@ void menuMainView(uint8_t event)
|
|||
putsModelName(0, 0, g_model.name, g_eeGeneral.currModel, 0);
|
||||
uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0);
|
||||
putsVBat(14*FW,0,att);
|
||||
if(s_timerState != TMR_OFF){
|
||||
att = (s_timerState==TMR_BEEPING ? BLINK : 0);
|
||||
if (g_model.timer1.mode) {
|
||||
att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
|
||||
putsTime(17*FW, 0, s_timerVal[0], att, att);
|
||||
}
|
||||
lcd_filled_rect(0, 0, DISPLAY_W, 8);
|
||||
|
@ -223,9 +225,9 @@ void menuMainView(uint8_t event)
|
|||
putsVBat(6*FW-1, 2*FH, att|NO_UNIT);
|
||||
lcd_putc(6*FW, 3*FH, 'V');
|
||||
|
||||
if (s_timerState != TMR_OFF) {
|
||||
uint8_t att = DBLSIZE | (s_timerState==TMR_BEEPING ? BLINK : 0);
|
||||
putsTime(12*FW+3, FH*2, s_timerVal[0], att,att);
|
||||
if (g_model.timer1.mode) {
|
||||
uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
|
||||
putsTime(12*FW+3, FH*2, s_timerVal[0], att, att);
|
||||
putsTmrMode(s_timerVal[0] >= 0 ? 9*FW-FW/2+5 : 9*FW-FW/2-2, FH*3, g_model.timer1.mode, SHRT_TM_MODE);
|
||||
}
|
||||
|
||||
|
@ -552,7 +554,9 @@ void menuMainView(uint8_t event)
|
|||
}
|
||||
#endif
|
||||
else { // timer2
|
||||
putsTime(33+FW+2, FH*5, timer2, DBLSIZE, DBLSIZE);
|
||||
putsTime(33+FW+2, FH*5, s_timerVal[1], DBLSIZE, DBLSIZE);
|
||||
putsTmrMode(s_timerVal[1] >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timer2.mode, SHRT_TM_MODE);
|
||||
// lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s
|
||||
}
|
||||
|
||||
theFile.DisplayProgressBar(20*FW+1);
|
||||
|
|
|
@ -387,7 +387,7 @@ void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, boo
|
|||
void menuProcModel(uint8_t event)
|
||||
{
|
||||
lcd_outdezNAtt(7*FW,0,g_eeGeneral.currModel+1,INVERS+LEADING0,2);
|
||||
MENU("SETUP", menuTabModel, e_Model, (g_model.protocol ? 10 : 11), {0,sizeof(g_model.name)-1,3,3,0,0,0,0,6,2,1});
|
||||
MENU("SETUP", menuTabModel, e_Model, (g_model.protocol ? 10 : 11), {0,sizeof(g_model.name)-1,2,2,0,0,0,0,6,2,1});
|
||||
|
||||
uint8_t sub = m_posVert;
|
||||
uint8_t y = 1*FH;
|
||||
|
@ -407,7 +407,6 @@ void menuProcModel(uint8_t event)
|
|||
putsTime(14*FW-3, y, timer->val,
|
||||
(sub==subN && m_posHorz==1 ? ((s_editMode>0) ? BLINK : INVERS):0),
|
||||
(sub==subN && m_posHorz==2 ? ((s_editMode>0) ? BLINK : INVERS):0) );
|
||||
lcd_putsnAtt(19*FW, y, PSTR("\x7e\x7f")+1-timer->dir,1,sub==subN && m_posHorz==3 ? ((s_editMode>0) ? BLINK : INVERS) : 0);
|
||||
if (sub==subN && (s_editMode>0 || p1valdiff)) {
|
||||
uint16_t timer_val = timer->val;
|
||||
switch (m_posHorz) {
|
||||
|
@ -429,9 +428,6 @@ void menuProcModel(uint8_t event)
|
|||
if ((int16_t)timer_val < 0) timer_val=0;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
CHECK_INCDEC_MODELVAR(event, timer->dir, 0, 1);
|
||||
break;
|
||||
}
|
||||
timer->val = timer_val;
|
||||
}
|
||||
|
|
|
@ -240,9 +240,7 @@ PACK(typedef struct t_PhaseData {
|
|||
|
||||
PACK(typedef struct t_TimerData {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t val:14;
|
||||
uint16_t persistent:1;
|
||||
uint16_t dir:1; // 0=>Count Down, 1=>Count Up
|
||||
uint16_t val;
|
||||
}) TimerData;
|
||||
|
||||
PACK(typedef struct t_ModelData {
|
||||
|
|
|
@ -102,8 +102,6 @@ uint8_t Translate()
|
|||
g_model.name[i] = char2idx(g_model.name[i]);
|
||||
g_model.timer1.mode = v3->tmrMode;
|
||||
g_model.timer1.val = v3->tmrVal;
|
||||
g_model.timer1.persistent = 0;
|
||||
g_model.timer1.dir = v3->tmrDir;
|
||||
g_model.protocol = v3->protocol;
|
||||
g_model.ppmNCH = v3->ppmNCH;
|
||||
g_model.thrTrim = v3->thrTrim;
|
||||
|
@ -119,8 +117,6 @@ uint8_t Translate()
|
|||
g_model.beepANACenter = v3->beepANACenter;
|
||||
g_model.timer2.mode = 0;
|
||||
g_model.timer2.val = 0;
|
||||
g_model.timer2.persistent = 0;
|
||||
g_model.timer2.dir = 0;
|
||||
for (uint8_t i=0; i<MAX_MIXERS; i++) {
|
||||
memmove(&g_model.mixData[i], &v3->mixData[i], sizeof(MixData)); // MixData size changed!
|
||||
g_model.mixData[i].mixWarn = g_model.mixData[i].phase;
|
||||
|
@ -294,8 +290,9 @@ void eeLoadModel(uint8_t id)
|
|||
eeCheck(true);
|
||||
}
|
||||
|
||||
resetTimer1();
|
||||
resetTimer2();
|
||||
// TODO optim: resetAll()
|
||||
resetTimer(0);
|
||||
resetTimer(1);
|
||||
#ifdef FRSKY
|
||||
resetTelemetry();
|
||||
FRSKY_setModelAlarms();
|
||||
|
|
|
@ -124,7 +124,9 @@ void *main_thread(void *)
|
|||
while (main_thread_running) {
|
||||
perMain();
|
||||
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
frskyHubData.baroAltitude = 500;
|
||||
#endif
|
||||
|
||||
sleep(1/*ms*/);
|
||||
}
|
||||
|
|
|
@ -409,7 +409,9 @@ int main(int argc,char **argv)
|
|||
th9xSim->show(); // Otherwise the main window gets centred across my two monitors, split down the middle.
|
||||
#endif
|
||||
|
||||
#ifdef FRSKY
|
||||
frskyStreaming = 1;
|
||||
#endif
|
||||
|
||||
StartEepromThread();
|
||||
StartMainThread();
|
||||
|
|
|
@ -35,18 +35,18 @@ void menuProcStatistic(uint8_t event)
|
|||
break;
|
||||
}
|
||||
|
||||
lcd_puts_P( 1*FW, FH*1, PSTR("TME"));
|
||||
putsTime( 5*FW, FH*1, s_timeCumAbs, 0, 0);
|
||||
lcd_puts_P( 17*FW, FH*1, PSTR("TSW"));
|
||||
putsTime( 11*FW, FH*1, s_timeCumSw, 0, 0);
|
||||
lcd_puts_P( 1*FW, FH*1, PSTR("TM1"));
|
||||
putsTime( 5*FW, FH*1, s_timerVal[0], 0, 0);
|
||||
lcd_puts_P( 17*FW, FH*1, PSTR("TM2"));
|
||||
putsTime( 12*FW, FH*1, s_timerVal[1], 0, 0);
|
||||
|
||||
lcd_puts_P( 1*FW, FH*2, PSTR("STK"));
|
||||
putsTime( 5*FW, FH*2, s_timeCumThr, 0, 0);
|
||||
lcd_puts_P( 17*FW, FH*2, PSTR("ST%"));
|
||||
putsTime( 11*FW, FH*2, s_timeCum16ThrP/16, 0, 0);
|
||||
putsTime( 12*FW, FH*2, s_timeCum16ThrP/16, 0, 0);
|
||||
|
||||
lcd_puts_P( 17*FW, FH*0, PSTR("TOT"));
|
||||
putsTime( 11*FW, FH*0, s_timeCumTot, 0, 0);
|
||||
putsTime( 12*FW, FH*0, s_timeCumTot, 0, 0);
|
||||
|
||||
uint16_t traceRd = s_traceCnt>MAXTRACE ? s_traceWr : 0;
|
||||
uint8_t x=5;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue