Skip to content

Commit

Permalink
KISS : request settings if needed (#640)
Browse files Browse the repository at this point in the history
The configuration is permanently reloaded during the configuration and therefore one cannot edit the values (PID etc..)
  • Loading branch information
xaviergriffon authored May 20, 2021
1 parent 2fc2f22 commit ea16efe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions MW_OSD/GlobalVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ static uint16_t vtxMaxPower = 0;
static uint8_t vtxBand = 0;
static uint8_t vtxChannel = 1;
static bool kissMessageToRequest = false;
static bool kissSettingsToRequest = false;
#else
static uint8_t pidP[PIDITEMS], pidI[PIDITEMS], pidD[PIDITEMS];
static uint8_t rcRate8,rcExpo8;
Expand Down
2 changes: 1 addition & 1 deletion MW_OSD/KISS.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void kiss_sync_settings() {
vtxLowPower = kissread_u16(KISS_SETTINGS_IDX_VTX_LOW_POWER);
vtxMaxPower = kissread_u16(KISS_SETTINGS_IDX_VTX_MAX_POWER);

modeMSPRequests &=~ REQ_MSP_KISS_SETTINGS;
kissSettingsToRequest = false;
}

void kiss_message() {
Expand Down
9 changes: 6 additions & 3 deletions MW_OSD/MW_OSD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1145,8 +1145,11 @@ void setMspRequests() {
#ifdef KISSGPS
REQ_MSP_KISS_GPS |
#endif
REQ_MSP_KISS_TELEMTRY |
REQ_MSP_KISS_SETTINGS;
REQ_MSP_KISS_TELEMTRY;
// The configuration is loaded at initialisation(If the version is not yet known) or if asked (navigation on KISS menu)
if (Kvar.version == 0 || kissSettingsToRequest) {
modeMSPRequests |= REQ_MSP_KISS_SETTINGS;
}

if (kissMessageToRequest) {
modeMSPRequests |= REQ_MSP_KISS_MESSAGE;
Expand Down Expand Up @@ -1199,7 +1202,7 @@ void setMspRequests() {
}

// If the version is not yet known, we request it
if (Kvar.version == 0) {
if (Kvar.version == 0 || kissSettingsToRequest) {
modeMSPRequests |= REQ_MSP_KISS_SETTINGS;
}
#endif // Not KISS
Expand Down
6 changes: 5 additions & 1 deletion MW_OSD/Serial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,10 @@ if((MwRcData[PITCHSTICK]>MAXSTICK)&&(MwRcData[YAWSTICK]>MAXSTICK)&&(MwRcData[THR
waitStick = 2; // Sticks must return to center before continue!
configMode = 1;
configPage = previousconfigPage;
#ifdef KISS
// Before displaying the configuration, refresh the settings which will then be updated when navigating in the KISS sub-menu
kissSettingsToRequest = true;
#endif
setMspRequests();
}
}
Expand Down Expand Up @@ -1835,7 +1839,7 @@ void kissBack() {
case SUBMENU_KISS_NOTCH_FILTERS:
case SUBMENU_KISS_LPF:
case SUBMENU_KISS_VTX:
modeMSPRequests |= REQ_MSP_KISS_SETTINGS;
kissSettingsToRequest = true;
break;
}
subConfigPage = -1;
Expand Down

0 comments on commit ea16efe

Please sign in to comment.