diff --git a/src/driver/vtx/sa.c b/src/driver/vtx/sa.c index a03e4fdec..befc1020a 100644 --- a/src/driver/vtx/sa.c +++ b/src/driver/vtx/sa.c @@ -52,6 +52,9 @@ const uint8_t default_dac_power_levels[VTX_POWER_LEVEL_MAX] = { 25, 40, 40, + 40, + 40, + 40, }; static void serial_smart_audio_reconfigure() { diff --git a/src/driver/vtx/sa.h b/src/driver/vtx/sa.h index c8102c459..0ba68fc29 100644 --- a/src/driver/vtx/sa.h +++ b/src/driver/vtx/sa.h @@ -28,7 +28,7 @@ typedef struct { uint8_t power; uint8_t mode; uint16_t frequency; - uint16_t dac_power_levels[5]; + uint16_t dac_power_levels[8]; } smart_audio_settings_t; void serial_smart_audio_init(); diff --git a/src/io/msp.c b/src/io/msp.c index 92e694ace..443c5edbd 100644 --- a/src/io/msp.c +++ b/src/io/msp.c @@ -473,12 +473,12 @@ static void msp_process_serial_cmd(msp_t *msp, msp_magic_t magic, uint16_t cmd, const uint16_t power = vtx_actual.power_table.values[level - 1]; - uint8_t buf[7]; + uint8_t buf[4 + VTX_POWER_LABEL_LEN]; buf[0] = level; buf[1] = power & 0xFF; buf[2] = power >> 8; - buf[3] = 3; - memcpy(buf + 4, vtx_actual.power_table.labels[level - 1], 3); + buf[3] = VTX_POWER_LABEL_LEN; + memcpy(buf + 4, vtx_actual.power_table.labels[level - 1], VTX_POWER_LABEL_LEN); msp_send_reply(msp, magic, cmd, buf, 7); break; @@ -495,7 +495,7 @@ static void msp_process_serial_cmd(msp_t *msp, msp_magic_t magic, uint16_t cmd, vtx_actual.power_table.values[level - 1] = payload[2] << 8 | payload[1]; const uint8_t label_len = payload[3]; - for (uint8_t i = 0; i < 3; i++) { + for (uint8_t i = 0; i < VTX_POWER_LABEL_LEN; i++) { vtx_actual.power_table.labels[level - 1][i] = i >= label_len ? 0 : payload[4 + i]; } msp_send_reply(msp, magic, cmd, NULL, 0); diff --git a/src/io/quic.h b/src/io/quic.h index beed421be..da3d89683 100644 --- a/src/io/quic.h +++ b/src/io/quic.h @@ -8,7 +8,7 @@ #define QUIC_MAGIC '#' #define QUIC_HEADER_LEN 4 -#define QUIC_PROTOCOL_VERSION MAKE_SEMVER(0, 2, 2) +#define QUIC_PROTOCOL_VERSION MAKE_SEMVER(0, 2, 3) typedef enum { QUIC_CMD_INVALID, diff --git a/src/io/vtx.h b/src/io/vtx.h index 3e2ac0a34..84263a583 100644 --- a/src/io/vtx.h +++ b/src/io/vtx.h @@ -4,6 +4,7 @@ #define VTX_SETTINGS_MAGIC 0xdeed #define VTX_APPLY_TRIES 50 +#define VTX_POWER_LABEL_LEN 5 typedef enum { VTX_DETECT_WAIT, @@ -42,6 +43,9 @@ typedef enum { VTX_POWER_LEVEL_3, VTX_POWER_LEVEL_4, VTX_POWER_LEVEL_5, + VTX_POWER_LEVEL_6, + VTX_POWER_LEVEL_7, + VTX_POWER_LEVEL_8, VTX_POWER_LEVEL_MAX, } vtx_power_level_t; @@ -65,13 +69,13 @@ typedef enum { typedef struct { uint8_t levels; - char labels[VTX_POWER_LEVEL_MAX][3]; + char labels[VTX_POWER_LEVEL_MAX][VTX_POWER_LABEL_LEN]; uint16_t values[VTX_POWER_LEVEL_MAX]; } vtx_power_table_t; -#define VTX_POWER_TABLE_MEMBERS \ - MEMBER(levels, uint8_t) \ - TSTR_ARRAY_MEMBER(labels, VTX_POWER_LEVEL_MAX, 3) \ +#define VTX_POWER_TABLE_MEMBERS \ + MEMBER(levels, uint8_t) \ + TSTR_ARRAY_MEMBER(labels, VTX_POWER_LEVEL_MAX, VTX_POWER_LABEL_LEN) \ ARRAY_MEMBER(values, VTX_POWER_LEVEL_MAX, uint16_t) typedef struct { diff --git a/src/io/vtx_smartaudio.c b/src/io/vtx_smartaudio.c index fc50eb738..31bea9e06 100644 --- a/src/io/vtx_smartaudio.c +++ b/src/io/vtx_smartaudio.c @@ -17,12 +17,15 @@ extern smart_audio_settings_t smart_audio_settings; static bool smart_audio_needs_update = false; -static const char smart_audio_power_level_labels[VTX_POWER_LEVEL_MAX][3] = { - "25 ", - "100", - "200", - "300", - "400", +static const char smart_audio_power_level_labels[VTX_POWER_LEVEL_MAX][VTX_POWER_LABEL_LEN] = { + "25 ", + "100 ", + "200 ", + "300 ", + "400 ", + " ", + " ", + " ", }; vtx_detect_status_t vtx_smart_audio_update(vtx_settings_t *actual) { diff --git a/src/io/vtx_tramp.c b/src/io/vtx_tramp.c index 5f64539a9..21ccb59a2 100644 --- a/src/io/vtx_tramp.c +++ b/src/io/vtx_tramp.c @@ -23,12 +23,15 @@ static const uint16_t tramp_power_level_values[VTX_POWER_LEVEL_MAX] = { 400, }; -static const char tramp_power_level_labels[VTX_POWER_LEVEL_MAX][3] = { - "25 ", - "100", - "200", - "300", - "400", +static const char tramp_power_level_labels[VTX_POWER_LEVEL_MAX][VTX_POWER_LABEL_LEN] = { + "25 ", + "100 ", + "200 ", + "300 ", + "400 ", + " ", + " ", + " ", }; vtx_detect_status_t vtx_tramp_update(vtx_settings_t *actual) { diff --git a/src/osd/render.c b/src/osd/render.c index 037fde1c9..b7de2d2ce 100644 --- a/src/osd/render.c +++ b/src/osd/render.c @@ -927,12 +927,14 @@ void osd_display() { case OSD_SCREEN_VTX: #ifdef USE_VTX if (vtx_settings.detected) { - static char power_level_labels_terminated[VTX_POWER_LEVEL_MAX][4]; + static const char *power_level_labels[VTX_POWER_LEVEL_MAX]; + static char power_level_labels_terminated[VTX_POWER_LEVEL_MAX][VTX_POWER_LABEL_LEN + 1]; if (!vtx_buffer_populated) { vtx_settings_copy = vtx_settings; for (uint8_t i = 0; i < VTX_POWER_LEVEL_MAX; i++) { - memcpy(power_level_labels_terminated[i], vtx_settings.power_table.labels[i], 3); - power_level_labels_terminated[i][3] = 0; + memcpy(power_level_labels_terminated[i], vtx_settings.power_table.labels[i], VTX_POWER_LABEL_LEN); + power_level_labels_terminated[i][VTX_POWER_LABEL_LEN] = 0; + power_level_labels[i] = power_level_labels_terminated[i]; } vtx_buffer_populated = 1; } @@ -945,15 +947,6 @@ void osd_display() { const char *channel_labels[] = {"1", "2", "3", "4", "5", "6", "7", "8"}; osd_menu_select_enum_adjust(4, 5, "CHANNEL", 20, &vtx_settings_copy.channel, channel_labels, VTX_CHANNEL_1, VTX_CHANNEL_8); - - // this ugly AF - const char *power_level_labels[] = { - power_level_labels_terminated[0], - power_level_labels_terminated[1], - power_level_labels_terminated[2], - power_level_labels_terminated[3], - power_level_labels_terminated[4], - }; osd_menu_select_enum_adjust(4, 6, "POWER LEVEL", 20, &vtx_settings_copy.power_level, power_level_labels, VTX_POWER_LEVEL_1, VTX_POWER_LEVEL_MAX - 1); const char *pit_mode_labels[] = {"OFF", "ON ", "N/A"};