diff --git a/src/main/config/config.c b/src/main/config/config.c index f3bd7ade0a..fd106bb731 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -100,6 +100,8 @@ void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, es master_t masterConfig; // master config struct with data independent from profiles profile_t *currentProfile; + +static uint8_t currentControlRateProfileIndex = 0; controlRateConfig_t *currentControlRateProfile; static const uint8_t EEPROM_CONF_VERSION = 84; @@ -244,13 +246,16 @@ static void resetControlRateConfig(controlRateConfig_t *controlRateConfig) { } +uint8_t getCurrentProfile(void) +{ + return masterConfig.current_profile_index; +} + static void setProfile(uint8_t profileIndex) { currentProfile = &masterConfig.profile[profileIndex]; } -static uint8_t currentControlRateProfileIndex = 0; - uint8_t getCurrentControlRateProfile(void) { return currentControlRateProfileIndex; diff --git a/src/main/config/config.h b/src/main/config/config.h index fc687abe9d..28e9256124 100644 --- a/src/main/config/config.h +++ b/src/main/config/config.h @@ -57,6 +57,8 @@ void readEEPROMAndNotify(void); void writeEEPROM(); void ensureEEPROMContainsValidData(void); void saveConfigAndNotify(void); + +uint8_t getCurrentProfile(void); void changeProfile(uint8_t profileIndex); uint8_t getCurrentControlRateProfile(void); diff --git a/src/main/io/display.c b/src/main/io/display.c index 0f6be9334e..7a614374a1 100644 --- a/src/main/io/display.c +++ b/src/main/io/display.c @@ -45,6 +45,8 @@ #include "config/runtime_config.h" +#include "config/config.h" + #include "display.h" #define MILLISECONDS_IN_A_SECOND (1000 * 1000) @@ -64,6 +66,7 @@ typedef enum { PAGE_BATTERY, PAGE_SENSORS, PAGE_RX, + PAGE_PROFILE, } pageId_e; const char* pageTitles[] = { @@ -71,12 +74,14 @@ const char* pageTitles[] = { "ARMED", "BATTERY", "SENSORS", - "RX" + "RX", + "PROFILE" }; #define PAGE_COUNT (PAGE_RX + 1) const uint8_t cyclePageIds[] = { + PAGE_PROFILE, PAGE_BATTERY, PAGE_SENSORS, PAGE_RX @@ -211,6 +216,17 @@ void showArmedPage(void) { } +void showProfilePage(void) +{ + tfp_sprintf(lineBuffer, "Profile: %d", getCurrentProfile()); + i2c_OLED_set_line(1); + i2c_OLED_send_string(lineBuffer); + + tfp_sprintf(lineBuffer, "Rate profile: %d", getCurrentControlRateProfile()); + i2c_OLED_set_line(2); + i2c_OLED_send_string(lineBuffer); +} + void showBatteryPage(void) { tfp_sprintf(lineBuffer, "Volts: %d.%d, Cells: %d", vbat / 10, vbat % 10, batteryCellCount); @@ -310,6 +326,9 @@ void updateDisplay(void) case PAGE_RX: showRxPage(); break; + case PAGE_PROFILE: + showProfilePage(); + break; } if (!armedState) { updateTicker(); @@ -337,6 +356,7 @@ void displaySetNextPageChangeAt(uint32_t futureMicros) { void displayEnablePageCycling(void) { pageState.pageFlags |= PAGE_STATE_FLAG_CYCLE_ENABLED; + pageState.cycleIndex = CYCLE_PAGE_ID_COUNT - 1; // start at first page } void displayDisablePageCycling(void) { diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index f507e2e076..fc3a79e8b2 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -1090,7 +1090,7 @@ static void cliProfile(char *cmdline) len = strlen(cmdline); if (len == 0) { - printf("profile %d\r\n", masterConfig.current_profile_index); + printf("profile %d\r\n", getCurrentProfile()); return; } else { i = atoi(cmdline);