diff --git a/radio/src/gui/128x64/gui.h b/radio/src/gui/128x64/gui.h index 7a852ca18..f495987cd 100644 --- a/radio/src/gui/128x64/gui.h +++ b/radio/src/gui/128x64/gui.h @@ -373,6 +373,7 @@ void drawStatusLine(); void menuTextView(event_t event); void pushMenuTextView(const char *filename); void pushModelNotes(); + void readModelNotes(); #endif #define LABEL(...) (uint8_t)-1 diff --git a/radio/src/gui/212x64/gui.h b/radio/src/gui/212x64/gui.h index ef907bfa5..7e868d30d 100644 --- a/radio/src/gui/212x64/gui.h +++ b/radio/src/gui/212x64/gui.h @@ -2,7 +2,7 @@ * Copyright (C) OpenTX * * Based on code named - * th9x - http://code.google.com/p/th9x + * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * @@ -244,7 +244,7 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e #endif void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event); - + extern uint8_t s_curveChan; void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags); @@ -296,6 +296,7 @@ extern char s_text_file[TEXT_FILENAME_MAXLEN]; void menuTextView(event_t event); void pushMenuTextView(const char *filename); void pushModelNotes(); +void readModelNotes(); void menuChannelsView(event_t event); @@ -339,4 +340,4 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes #define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky #define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView) -#endif // _GUI_H_ \ No newline at end of file +#endif // _GUI_H_ diff --git a/radio/src/gui/480x272/menus.cpp b/radio/src/gui/480x272/menus.cpp index 206a45559..55b8ddef0 100644 --- a/radio/src/gui/480x272/menus.cpp +++ b/radio/src/gui/480x272/menus.cpp @@ -66,6 +66,32 @@ void pushMenu(MenuHandlerFunc newMenu) TRACE("pushMenu(%d, %p)", menuLevel, newMenu); } +void readModelNotes() +{ + LED_ERROR_BEGIN(); + + strcpy(s_text_file, MODELS_PATH "/"); + char *buf = strcat_currentmodelname(&s_text_file[sizeof(MODELS_PATH)]); + strcpy(buf, TEXT_EXT); + if (!isFileAvailable(s_text_file)) { + char *buf = strAppendFilename(&s_text_file[sizeof(MODELS_PATH)], g_eeGeneral.currModelFilename, LEN_MODEL_FILENAME); + strcpy(buf, TEXT_EXT); + } + + clearKeyEvents(); + event_t event = EVT_ENTRY; + while (event != EVT_KEY_FIRST(KEY_EXIT)) { + lcdRefreshWait(); + lcdClear(); + menuTextView(event); + event = getEvent(); + lcdRefresh(); + wdt_reset(); + } + + LED_ERROR_END(); +} + bool menuModelNotes(event_t event) { if (event == EVT_ENTRY) { diff --git a/radio/src/gui/480x272/menus.h b/radio/src/gui/480x272/menus.h index 0c23639e8..7222f261d 100644 --- a/radio/src/gui/480x272/menus.h +++ b/radio/src/gui/480x272/menus.h @@ -505,6 +505,7 @@ extern void (*popupMenuHandler)(const char * result); extern char s_text_file[TEXT_FILENAME_MAXLEN]; void pushMenuTextView(const char * filename); void pushModelNotes(); +void readModelNotes(); #define LABEL(...) (uint8_t)-1 diff --git a/radio/src/gui/common/stdlcd/view_text.cpp b/radio/src/gui/common/stdlcd/view_text.cpp index c61f8642a..9f89f822b 100644 --- a/radio/src/gui/common/stdlcd/view_text.cpp +++ b/radio/src/gui/common/stdlcd/view_text.cpp @@ -2,7 +2,7 @@ * Copyright (C) OpenTX * * Based on code named - * th9x - http://code.google.com/p/th9x + * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * @@ -102,6 +102,28 @@ void readTextFile(int & lines_count) #define EVT_KEY_PREVIOUS_LINE EVT_KEY_FIRST(KEY_UP) #endif +void readModelNotes() +{ + LED_ERROR_BEGIN(); + + strcpy(s_text_file, MODELS_PATH "/"); + char *buf = strcat_modelname(&s_text_file[sizeof(MODELS_PATH)], g_eeGeneral.currModel); + strcpy(buf, TEXT_EXT); + + clearKeyEvents(); + event_t event = EVT_ENTRY; + while (event != EVT_KEY_BREAK(KEY_EXIT)) { + lcdRefreshWait(); + lcdClear(); + menuTextView(event); + event = getEvent(); + lcdRefresh(); + wdt_reset(); + } + + LED_ERROR_END(); +} + void menuTextView(event_t event) { static int lines_count; diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 35e5e2d76..81ab17aec 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1134,7 +1134,7 @@ void checkAll() #if defined(CPUARM) if (g_model.displayChecklist && modelHasNotes()) { - pushModelNotes(); + readModelNotes(); } #endif diff --git a/radio/src/storage/storage_common.cpp b/radio/src/storage/storage_common.cpp index f18d9883f..1840b9050 100644 --- a/radio/src/storage/storage_common.cpp +++ b/radio/src/storage/storage_common.cpp @@ -72,17 +72,6 @@ void postModelLoad(bool alarms) AUDIO_FLUSH(); flightReset(false); - if (pulsesStarted()) { -#if defined(GUI) - if (alarms) { - checkAll(); - PLAY_MODEL_NAME(); - } -#endif - resumePulses(); - } - - customFunctionsReset(); restoreTimers(); @@ -100,7 +89,15 @@ void postModelLoad(bool alarms) LOAD_MODEL_CURVES(); resumeMixerCalculations(); - // TODO pulses should be started after mixer calculations ... + if (pulsesStarted()) { +#if defined(GUI) + if (alarms) { + checkAll(); + PLAY_MODEL_NAME(); + } +#endif + resumePulses(); + } #if defined(TELEMETRY_FRSKY) frskySendAlarms();