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:
3djc
2018-06-09 11:34:56 +02:00
committed by Bertrand Songis
parent 45804b318a
commit 13c5387dc9
7 changed files with 65 additions and 17 deletions
+1
View File
@@ -373,6 +373,7 @@ void drawStatusLine();
void menuTextView(event_t event); void menuTextView(event_t event);
void pushMenuTextView(const char *filename); void pushMenuTextView(const char *filename);
void pushModelNotes(); void pushModelNotes();
void readModelNotes();
#endif #endif
#define LABEL(...) (uint8_t)-1 #define LABEL(...) (uint8_t)-1
+4 -3
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * 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 * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * 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 #endif
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event); void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event);
extern uint8_t s_curveChan; extern uint8_t s_curveChan;
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags); 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 menuTextView(event_t event);
void pushMenuTextView(const char *filename); void pushMenuTextView(const char *filename);
void pushModelNotes(); void pushModelNotes();
void readModelNotes();
void menuChannelsView(event_t event); 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_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky
#define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView) #define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView)
#endif // _GUI_H_ #endif // _GUI_H_
+26
View File
@@ -66,6 +66,32 @@ void pushMenu(MenuHandlerFunc newMenu)
TRACE("pushMenu(%d, %p)", menuLevel, 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) bool menuModelNotes(event_t event)
{ {
if (event == EVT_ENTRY) { if (event == EVT_ENTRY) {
+1
View File
@@ -505,6 +505,7 @@ extern void (*popupMenuHandler)(const char * result);
extern char s_text_file[TEXT_FILENAME_MAXLEN]; extern char s_text_file[TEXT_FILENAME_MAXLEN];
void pushMenuTextView(const char * filename); void pushMenuTextView(const char * filename);
void pushModelNotes(); void pushModelNotes();
void readModelNotes();
#define LABEL(...) (uint8_t)-1 #define LABEL(...) (uint8_t)-1
+23 -1
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * 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 * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * 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) #define EVT_KEY_PREVIOUS_LINE EVT_KEY_FIRST(KEY_UP)
#endif #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) void menuTextView(event_t event)
{ {
static int lines_count; static int lines_count;
+1 -1
View File
@@ -1134,7 +1134,7 @@ void checkAll()
#if defined(CPUARM) #if defined(CPUARM)
if (g_model.displayChecklist && modelHasNotes()) { if (g_model.displayChecklist && modelHasNotes()) {
pushModelNotes(); readModelNotes();
} }
#endif #endif
+9 -12
View File
@@ -72,17 +72,6 @@ void postModelLoad(bool alarms)
AUDIO_FLUSH(); AUDIO_FLUSH();
flightReset(false); flightReset(false);
if (pulsesStarted()) {
#if defined(GUI)
if (alarms) {
checkAll();
PLAY_MODEL_NAME();
}
#endif
resumePulses();
}
customFunctionsReset(); customFunctionsReset();
restoreTimers(); restoreTimers();
@@ -100,7 +89,15 @@ void postModelLoad(bool alarms)
LOAD_MODEL_CURVES(); LOAD_MODEL_CURVES();
resumeMixerCalculations(); 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) #if defined(TELEMETRY_FRSKY)
frskySendAlarms(); frskySendAlarms();