diff --git a/src/gruvin9x/somo14d.cpp b/src/gruvin9x/somo14d.cpp index 17709a2fa..546c58624 100644 --- a/src/gruvin9x/somo14d.cpp +++ b/src/gruvin9x/somo14d.cpp @@ -175,5 +175,9 @@ void pushPrompt(uint16_t prompt) bool isPlaying() { +#if defined(SIMU) + return false; +#else return TIMSK4 & (1<= DISPLAY_W) return; + if (h<0) { y+=h; h=-h; } + if (y<0) { h+=y; y=0; } + if (y+h > DISPLAY_H) { h = DISPLAY_H - y; } + + if (pat==DOTTED && !(y%2)) + pat = ~pat; + + uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ]; + y = y % 8; + if (y) { + assert(p >= displayBuf && p < DISPLAY_END); + uint8_t msk = ~(BITMASK(y)-1); + h -= 8-y; + if (h < 0) + msk -= ~(BITMASK(8+h)-1); + lcd_mask(p, msk & pat, att); + p += DISPLAY_W; + } + while (h>=8) { + assert(p >= displayBuf && p < DISPLAY_END); + lcd_mask(p, pat, att); + p += DISPLAY_W; + h -= 8; + } + if (h>0) { + assert(p >= displayBuf && p < DISPLAY_END); + lcd_mask(p, (BITMASK(h)-1) & pat, att); + } +} +#else void lcd_vlineStip(uint8_t x, int8_t y, int8_t h, uint8_t pat) { if (x >= DISPLAY_W) return; @@ -415,6 +450,7 @@ void lcd_vlineStip(uint8_t x, int8_t y, int8_t h, uint8_t pat) *p ^= ~(BITMASK(h)-1) & pat; } } +#endif void lcd_vline(uint8_t x, int8_t y, int8_t h) { diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 85219c441..cd45434a7 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -1085,22 +1085,30 @@ int16_t curveFn(int16_t x) } #endif -void DrawCurve(FnFuncP fn) +void DrawCurve(FnFuncP fn, uint8_t offset=0) { - lcd_vlineStip(X0, 0, DISPLAY_H, 0xee); - lcd_hlineStip(X0-WCHART, Y0, WCHART*2, 0xee); + lcd_vlineStip(X0-offset, 0, DISPLAY_H, 0xee); + lcd_hlineStip(X0-WCHART-offset, Y0, WCHART*2, 0xee); - for (int8_t xv=-WCHART+1; xv NUM_POINTS-CURVES_OFFSET_SHIFT(MAX_CURVES)) { + if (g_model.curves[MAX_CURVES-1] + shift > NUM_POINTS-5*MAX_CURVES) { AUDIO_WARNING2(); return false; } @@ -1112,7 +1120,7 @@ bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0) } int8_t *nextCrv = curveaddress(index+1); - memmove(nextCrv+shift, nextCrv, CURVES_OFFSET_SHIFT(MAX_CURVES-index-1)+g_model.curves[MAX_CURVES-1]); + memmove(nextCrv+shift, nextCrv, 5*(MAX_CURVES-index-1)+g_model.curves[MAX_CURVES-1]); if (shift < 0) memclear(&g_model.points[NUM_POINTS-1] + shift, -shift); while (index0 && m_posHorz 4) m_posHorz = -4; for (uint8_t i=0; i0) { + if (s_editMode > 0) { if (--s_editMode == 0) m_posHorz = 0; } @@ -1176,7 +1184,7 @@ void menuProcCurveOne(uint8_t event) case EVT_KEY_REPT(KEY_LEFT): case EVT_KEY_FIRST(KEY_LEFT): if (s_editMode==1 && m_posHorz>0) m_posHorz--; - if (s_editMode==0) { + if (s_editMode <= 0) { if (crv.custom) { moveCurve(s_curveChan, -crv.points+2); } @@ -1192,7 +1200,7 @@ void menuProcCurveOne(uint8_t event) case EVT_KEY_REPT(KEY_RIGHT): case EVT_KEY_FIRST(KEY_RIGHT): if (s_editMode==1 && m_posHorz<(crv.points-1)) m_posHorz++; - if (s_editMode==0) { + if (s_editMode <= 0) { if (!crv.custom) { moveCurve(s_curveChan, crv.points-2, crv.points); } @@ -1214,20 +1222,26 @@ void menuProcCurveOne(uint8_t event) } lcd_putsLeft(7*FH, PSTR("Type")); - uint8_t attr = (s_editMode==0 ? INVERS : 0); + uint8_t attr = (s_editMode <= 0 ? INVERS : 0); lcd_outdezAtt(5*FW-2, 7*FH, crv.points, LEFT|attr); lcd_putsAtt(lcdLastPos, 7*FH, crv.custom ? PSTR("pt'") : PSTR("pt"), attr); + DrawCurve(curveFn); + for (uint8_t i=0; i0 && i0 && m_posHorz==i) { - if (s_editMode==1 || !BLINK_ON_PHASE) lcd_filled_rect(xx-1, yy-2, 5, 5); // do selection square + if (s_editMode==1 || !BLINK_ON_PHASE) { + // do selection square + lcd_filled_rect(xx-1, yy-2, 5, 5, SOLID, BLACK); + lcd_filled_rect(xx, yy-1, 3, 3, SOLID); + } int8_t x = -100 + 200*i/(crv.points-1); if (crv.custom && i>0 && i0 || p1valdiff)); switch (j) { case 0: - if (sd->func <= FUNC_SAFETY_CH16 && (FSW_PARAM(sd) & 1)) { + if (sd->func <= FUNC_SAFETY_CH16 && sd->delay) { if (sd->swtch > MAX_SWITCH+1) sd->swtch -= (MAX_SWITCH+1); if (sd->swtch < -MAX_SWITCH-1) sd->swtch += (MAX_SWITCH+1); } - putsSwitches(3, y, sd->swtch, SWONOFF | attr | ((abs(sd->swtch) <= (MAX_SWITCH+1) && getSwitch(sd->swtch, 0) && (sd->func >= 16 || (FSW_PARAM(sd) & 1))) ? BOLD : 0)); + putsSwitches(3, y, sd->swtch, SWONOFF | attr | ((abs(sd->swtch) <= (MAX_SWITCH+1) && getSwitch(sd->swtch, 0) && (sd->func >= 16 || sd->delay)) ? BOLD : 0)); if (active) { CHECK_INCDEC_MODELSWITCH( event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1); } @@ -2578,10 +2590,8 @@ void menuProcFunctionSwitches(uint8_t event) lcd_putsiAtt(15*FW, y, STR_VFSWRESET, FSW_PARAM(sd), attr); } else if (sd->func <= FUNC_SAFETY_CH16) { - int8_t value = ((int8_t)FSW_PARAM(sd) >> 1); - lcd_outdezAtt(18*FW, y, limit((int8_t)-125, (int8_t)(value * 2), (int8_t)125), attr); - if (active) FSW_PARAM(sd) = (FSW_PARAM(sd) & 1) + (checkIncDecModel(event, value, -63, 63) << 1); - break; + val_min = -125; val_max = 125; + lcd_outdezAtt(18*FW, y, FSW_PARAM(sd), attr); } else { if (attr) m_posHorz = 0; @@ -2600,11 +2610,11 @@ void menuProcFunctionSwitches(uint8_t event) case 3: if (sd->swtch && sd->func <= FUNC_SAFETY_CH16) { #if defined(GRAPHICS) - menu_lcd_onoff(20*FW, y, (FSW_PARAM(sd) & 1), attr ) ; + menu_lcd_onoff(20*FW, y, sd->delay, attr ) ; #else - menu_lcd_onoff(18*FW+2, y, (FSW_PARAM(sd) & 1), attr ) ; + menu_lcd_onoff(18*FW+2, y, sd->delay, attr ) ; #endif - if (active) FSW_PARAM(sd) = (FSW_PARAM(sd) & 0xfe) + checkIncDecModel(event, FSW_PARAM(sd) & 1, 0, 1); + if (active) CHECK_INCDEC_MODELVAR(event, sd->delay, 0, 1); } else if (attr) { m_posHorz = 0; diff --git a/src/myeeprom.h b/src/myeeprom.h index 59d29f55a..428f911eb 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -350,12 +350,15 @@ PACK(typedef struct t_FuncSwData { // Function Switches data int8_t swtch; //input uint8_t func; char param[6]; + uint8_t delay; + uint8_t spare; }) FuncSwData; #define FSW_PARAM(p) (*((uint32_t*)(p)->param)) #else PACK(typedef struct t_FuncSwData { // Function Switches data int8_t swtch; //input - uint8_t func; + uint8_t func:5; + uint8_t delay:3; uint8_t param; }) FuncSwData; #define FSW_PARAM(p) ((p)->param) @@ -593,7 +596,7 @@ PACK(typedef struct t_PhaseData { #if defined(PCBARM) #define MAX_CURVES 16 #define NUM_POINTS 512 -#define CURVTYPE uint16_t +#define CURVTYPE int16_t #else #define MAX_CURVES 8 #define NUM_POINTS (112-MAX_CURVES) diff --git a/src/open9x.cpp b/src/open9x.cpp index 8a1e3f4be..adb194a2a 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -162,17 +162,10 @@ LimitData *limitaddress(uint8_t idx) return &g_model.limitData[idx]; } -#if defined(PCBARM) -int8_t *curveaddress(uint8_t idx) -{ - return &g_model.points[idx==0 ? 0 : g_model.curves[idx-1]]; -} -#else int8_t *curveaddress(uint8_t idx) { return &g_model.points[idx==0 ? 0 : 5*idx+g_model.curves[idx-1]]; } -#endif CurveInfo curveinfo(uint8_t idx) { @@ -1798,8 +1791,8 @@ void evalFunctions() swtch += MAX_SWITCH+1; } if (getSwitch(swtch, 0)) { - if (sd->func < FUNC_TRAINER && (FSW_PARAM(sd) & 1)) { - safetyCh[sd->func] = limit((int8_t)-125, (int8_t)(((int8_t)FSW_PARAM(sd) >> 1) * 2), (int8_t)125); + if (sd->func < FUNC_TRAINER && sd->delay) { + safetyCh[sd->func] = FSW_PARAM(sd); } if (~activeFunctions & function_mask) { diff --git a/src/open9x.h b/src/open9x.h index 1d59ac8d1..94781cb82 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -819,12 +819,6 @@ struct CurveInfo { }; extern CurveInfo curveinfo(uint8_t idx); -#if defined(PCBARM) -#define CURVES_OFFSET_SHIFT(x) (0) -#else -#define CURVES_OFFSET_SHIFT(x) (5*(x)) -#endif - extern void deleteExpoMix(uint8_t expo, uint8_t idx); extern void incSubtrim(uint8_t idx, int16_t inc); diff --git a/src/simpgmspace.cpp b/src/simpgmspace.cpp index a7cad2f85..59df9de80 100644 --- a/src/simpgmspace.cpp +++ b/src/simpgmspace.cpp @@ -175,7 +175,9 @@ void *main_thread(void *) if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on if (main_thread_running == 1) { +#if defined(SPLASH) doSplash(); +#endif #if !defined(PCBARM) checkLowEEPROM(); diff --git a/src/stock/voice.cpp b/src/stock/voice.cpp index e34a6db1d..41a17fcbc 100644 --- a/src/stock/voice.cpp +++ b/src/stock/voice.cpp @@ -50,6 +50,10 @@ void putVoiceQueueUpper( uint8_t value ) void pushPrompt( uint8_t value ) { +#ifdef SIMU + printf("playFile(\"%04d.ad4\")\n", value); fflush(stdout); +#endif + struct t_voice *vptr; vptr = voiceaddress(); diff --git a/src/stock/voice.h b/src/stock/voice.h index b7a721a18..7edcb31dd 100644 --- a/src/stock/voice.h +++ b/src/stock/voice.h @@ -48,8 +48,8 @@ #define V_WAIT_BUSY_OFF 4 #define V_WAIT_BUSY_DELAY 5 -#define PROMPT_SYSTEM_BASE 300 -#define PROMPT_CUSTOM_BASE 400 +#define PROMPT_SYSTEM_BASE 170 +#define PROMPT_CUSTOM_BASE 200 struct t_voice { @@ -74,7 +74,11 @@ extern struct t_voice Voice ; inline bool isPlaying() { +#if defined(SIMU) + return false; +#else return Voice.VoiceState != V_IDLE; +#endif } /* diff --git a/util/tts.py b/util/tts.py index 3d93c81b3..b91d80173 100644 --- a/util/tts.py +++ b/util/tts.py @@ -133,9 +133,9 @@ if __name__ == "__main__": systemSounds.extend(generate(s, 40+i)) for i, s in enumerate(["volts", "amps", "meters per second", "", "km per hour", "meters", "degrees", "percent", "milliamps", "milliamps per hour", "watts", "", "feet", "knots"]): systemSounds.extend(generate(s, 50+i)) - for s, f, a in [(u"trim center", "midtrim", 314), + for s, f, a in [(u"trim center", "midtrim", 184), (u"maximum trim reached", "endtrim", 0), - (u"transmitter battery low", "lowbatt", 301), + (u"transmitter battery low", "lowbatt", 171), ]: systemSounds.extend(generate(s, f, a)) for i, (s, f) in enumerate([ @@ -167,7 +167,7 @@ if __name__ == "__main__": (u"flight mode eight", "fltmd8"), (u"flight mode nine", "fltmd9"), ]): - sounds.extend(generate(s, f, 400+i)) + sounds.extend(generate(s, f, 200+i)) elif "fr" in sys.argv: @@ -203,7 +203,7 @@ if __name__ == "__main__": (u"fin écolage", "trnoff"), (u"moteur coupé", "engoff"), ]): - sounds.extend(generate(s, f, 400+i)) + sounds.extend(generate(s, f, 200+i)) elif "it" in sys.argv: if "sapi" in sys.argv: tts.SetVoiceByName("ScanSoftVirginie_Full_22kHz") @@ -221,9 +221,9 @@ if __name__ == "__main__": systemSounds.extend(generate(s, 103+i)) for i, s in enumerate(["volt", "amper", "meetri per secondo", "", "chilomeetri ora", "meetri", "gradi", "percento", "milliamper", "milliamper ora", "watt", "", "piedi", "nodi"]): systemSounds.extend(generate(s, 112+i)) - for a, s, f in [(u"trim centrato", "midtrim", 314), + for a, s, f in [(u"trim centrato", "midtrim", 184), (u"massimo trim raggiunto", "endtrim", 0), - (u"batteria della radio scarica", "lowbatt", 301), + (u"batteria della radio scarica", "lowbatt", 171), ]: systemSounds.extend(generate(s, f, a)) for i, s in enumerate(["timer", "", "tensione", "tensione", "trasmissione", "ricezione", "altitudine", "motore", @@ -260,8 +260,13 @@ if __name__ == "__main__": (u"fase di volo 8", "fltmd8"), (u"fase di volo 9", "fltmd9"), ]): - sounds.extend(generate(s, f, 400+i)) + sounds.extend(generate(s, f, 200+i)) + if 'ad4' in sys.argv: + voice += "-stock" + else: + voice += "-sky9x" + if "csv" in sys.argv: csvFile = file(voice + ".csv", "w") for f, s in systemSounds: