Double warnings on USB disconnect

This commit is contained in:
Bertrand Songis
2019-06-18 23:28:59 +02:00
parent eaf595bd76
commit ffe8d821cd
4 changed files with 38 additions and 22 deletions
+7 -14
View File
@@ -1481,26 +1481,18 @@ void doMixerCalculations()
s_mixer_first_run_done = true;
}
#define OPENTX_START_NO_SPLASH 0x01
#define OPENTX_START_NO_CHECKS 0x02
#if !defined(OPENTX_START_DEFAULT_ARGS)
#define OPENTX_START_DEFAULT_ARGS 0
#endif
void opentxStart(const uint8_t startType = OPENTX_START_DEFAULT_ARGS)
void opentxStart(const uint8_t startOptions = OPENTX_START_DEFAULT_ARGS)
{
TRACE("opentxStart(%u)", startType);
TRACE("opentxStart(%u)", startOptions);
if (startType & OPENTX_START_NO_CHECKS) {
return;
}
uint8_t calibration_needed = (g_eeGeneral.chkSum != evalChkSum());
uint8_t calibration_needed = !(startOptions & OPENTX_START_NO_CALIBRATION) && (g_eeGeneral.chkSum != evalChkSum());
#if defined(GUI)
if (!calibration_needed && !(startType & OPENTX_START_NO_SPLASH)) {
if (!calibration_needed && !(startOptions & OPENTX_START_NO_SPLASH)) {
doSplash();
}
#endif
@@ -1523,7 +1515,7 @@ void opentxStart(const uint8_t startType = OPENTX_START_DEFAULT_ARGS)
if (calibration_needed) {
chainMenu(menuFirstCalib);
}
else {
else if (!(startOptions & OPENTX_START_NO_CHECKS)) {
checkAlarm();
checkAll();
PLAY_MODEL_NAME();
@@ -1601,7 +1593,8 @@ void opentxResume()
loadFontCache();
#endif
opentxStart(OPENTX_START_NO_SPLASH);
// removed to avoid the double warnings (throttle, switch, etc.)
// opentxStart(OPENTX_START_NO_SPLASH | OPENTX_START_NO_CALIBRATION | OPENTX_START_NO_CHECKS);
referenceSystemAudioFiles();
+4
View File
@@ -1076,6 +1076,10 @@ void opentxClose(uint8_t shutdown=true);
void opentxInit();
void opentxResume();
constexpr uint8_t OPENTX_START_NO_SPLASH = 0x01;
constexpr uint8_t OPENTX_START_NO_CALIBRATION = 0x02;
constexpr uint8_t OPENTX_START_NO_CHECKS = 0x04;
#if defined(STATUS_LEDS)
#define LED_ERROR_BEGIN() ledRed()
#define LED_ERROR_END() ledBlue()
+25 -6
View File
@@ -353,15 +353,35 @@ enum ChannelsProtocols {
PROTOCOL_CHANNELS_PXX2
};
inline bool pulsesStarted() { return moduleState[0].protocol != PROTOCOL_CHANNELS_UNINITIALIZED; }
inline void pausePulses() { s_pulses_paused = true; }
inline void resumePulses() { s_pulses_paused = false; }
inline void stopPulses()
{
s_pulses_paused = true;
moduleState[0].protocol = PROTOCOL_CHANNELS_UNINITIALIZED;
}
#define SEND_FAILSAFE_NOW(idx) moduleState[idx].counter = 1
inline bool pulsesStarted()
{
return moduleState[0].protocol != PROTOCOL_CHANNELS_UNINITIALIZED;
}
inline void pausePulses()
{
s_pulses_paused = true;
}
inline void resumePulses()
{
s_pulses_paused = false;
}
inline void SEND_FAILSAFE_NOW(uint8_t idx)
{
moduleState[idx].counter = 1;
}
inline void SEND_FAILSAFE_1S()
{
for (int i=0; i<NUM_MODULES; i++) {
for (uint8_t i=0; i<NUM_MODULES; i++) {
moduleState[i].counter = 100;
}
}
@@ -370,7 +390,6 @@ inline void SEND_FAILSAFE_1S()
// for channels not set previously to HOLD or NOPULSE
void setCustomFailsafe(uint8_t moduleIndex);
enum R9MLiteLBTPowerValues {
R9M_LITE_LBT_POWER_25 = 0,
R9M_LITE_LBT_POWER_25_16,
+2 -2
View File
@@ -173,10 +173,10 @@ void StartSimu(bool tests, const char * sdPath, const char * settingsPath)
if (simu_running)
return;
moduleState[0].protocol = PROTOCOL_CHANNELS_UNINITIALIZED;
stopPulses();
menuLevel = 0;
simu_start_mode = (tests ? 0 : 0x02 /* OPENTX_START_NO_CHECKS */);
simu_start_mode = (tests ? 0 : OPENTX_START_NO_SPLASH | OPENTX_START_NO_CALIBRATION | OPENTX_START_NO_CHECKS);
simu_shutdown = false;
simuFatfsSetPaths(sdPath, settingsPath);