Disable pulse while model notes are displayed (#5758)
* Implement model note view without menu handler. Use it before pulse starts * Also at model change. Handle wd reset and start pulses after mixer * Fix Horus compile * Fix Horus crash * Fix coding style issue
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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_
|
||||
#endif // _GUI_H_
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1134,7 +1134,7 @@ void checkAll()
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (g_model.displayChecklist && modelHasNotes()) {
|
||||
pushModelNotes();
|
||||
readModelNotes();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user