Skip to content

Commit 2a4c672

Browse files
authored
Merge pull request #246 from hd-zero/fix-setting-when-exit-0mw
fix setting when enter 0mw with shortcut
2 parents fa22631 + 3e33e76 commit 2a4c672

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

src/msp_displayport.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ void msp_send_type(uint8_t dl, uint8_t version, uint8_t header_type) {
771771
}
772772

773773
void msp_send_command(uint8_t dl, uint8_t version) {
774-
msp_send_type(dl, version, MSP_HEADER_COMMAND);
774+
msp_send_type(dl, version, MSP_HEADER_COMMAND);
775775
}
776776

777777
void msp_send_response(uint8_t dl, uint8_t version) {
@@ -810,14 +810,12 @@ void msp_send_cmd_tx_v2(uint16_t request) {
810810
msp_tx(msp_send_header_v2(0, request));
811811
}
812812

813-
// Send requests to the FC.
814-
void msp_cmd_tx()
815-
{
813+
// Send requests to the FC.
814+
void msp_cmd_tx() {
816815
if ((fc_lock & FC_STARTUP_LOCK) == 0) {
817816
if ((fc_lock & FC_VARIANT_LOCK) == 0) {
818817
msp_send_cmd_tx(MSP_FC_VARIANT);
819-
}
820-
else if ((fc_lock & FC_VTX_CONFIG_LOCK) == 0) {
818+
} else if ((fc_lock & FC_VTX_CONFIG_LOCK) == 0) {
821819
msp_send_cmd_tx(MSP_GET_VTX_CONFIG);
822820
} else {
823821
fc_lock |= FC_STARTUP_LOCK;
@@ -836,7 +834,7 @@ void msp_cmd_tx()
836834
msp_send_cmd_tx(MSP_GET_OSD_CANVAS);
837835
msp_send_cmd_tx(MSP_STATUS);
838836
}
839-
837+
840838
// These messages are not required when armed.
841839
if (!g_IS_ARMED) {
842840
if (timer_2hz) { // in case box ids move (say during configuration)
@@ -1030,20 +1028,20 @@ void parse_status() {
10301028
uint8_t isBTFL = msp_cmp_fc_variant("BTFL");
10311029

10321030
if (g_arm_mask) {
1033-
offset = (isBTFL && g_arm_page > 3) ? 12 : 6;
1034-
g_IS_ARMED = msp_rx_buf[offset+g_arm_page] & g_arm_mask;
1031+
offset = (isBTFL && g_arm_page > 3) ? 12 : 6;
1032+
g_IS_ARMED = msp_rx_buf[offset + g_arm_page] & g_arm_mask;
10351033
}
10361034

10371035
if (g_boxCamera1_mask) {
1038-
offset = (isBTFL && g_boxCamera1_page > 3) ? 12 : 6;
1039-
if (msp_rx_buf[offset+g_boxCamera1_page] & g_boxCamera1_mask) {
1036+
offset = (isBTFL && g_boxCamera1_page > 3) ? 12 : 6;
1037+
if (msp_rx_buf[offset + g_boxCamera1_page] & g_boxCamera1_mask) {
10401038
camSelected = camera_switch(2);
10411039
}
10421040
}
1043-
1041+
10441042
if (!camSelected && g_boxCamera2_mask) {
1045-
offset = (isBTFL && g_boxCamera2_page > 3) ? 12 : 6;
1046-
if (msp_rx_buf[offset+g_boxCamera2_page] & g_boxCamera2_mask) {
1043+
offset = (isBTFL && g_boxCamera2_page > 3) ? 12 : 6;
1044+
if (msp_rx_buf[offset + g_boxCamera2_page] & g_boxCamera2_mask) {
10471045
if (g_camera_switch == SWITCH_TYPE_PCA9557) {
10481046
camSelected = camera_switch(3);
10491047
}
@@ -1052,7 +1050,7 @@ void parse_status() {
10521050

10531051
if (!camSelected) {
10541052
camera_switch(1);
1055-
}
1053+
}
10561054

10571055
#if (0)
10581056
g_IS_PARALYZE = (msp_rx_buf[9] & 0x80);
@@ -1090,7 +1088,7 @@ void parse_boxids(uint8_t msgLen) {
10901088

10911089
g_arm_mask = g_boxCamera1_mask = g_boxCamera2_mask = 0;
10921090

1093-
for (idx = 0, boxCount = 0; idx < msgLen && boxCount < 4 ; idx++) {
1091+
for (idx = 0, boxCount = 0; idx < msgLen && boxCount < 4; idx++) {
10941092
if (msp_rx_buf[idx] == armBox) {
10951093
g_arm_page = idx / 8;
10961094
g_arm_mask = 1 << (idx % 8);
@@ -1339,21 +1337,21 @@ void parseiNavMspStatus(void) {
13391337
uint8_t camSelected = 0;
13401338

13411339
if (g_arm_mask) {
1342-
g_IS_ARMED = msp_rx_buf[13+g_arm_page] & g_arm_mask;
1340+
g_IS_ARMED = msp_rx_buf[13 + g_arm_page] & g_arm_mask;
13431341
}
13441342

13451343
if (g_boxCamera1_mask) {
1346-
if (msp_rx_buf[13+g_boxCamera1_page] & g_boxCamera1_mask) {
1344+
if (msp_rx_buf[13 + g_boxCamera1_page] & g_boxCamera1_mask) {
13471345
camSelected = camera_switch(2);
13481346
}
13491347
}
1350-
1348+
13511349
if (!camSelected && g_boxCamera2_mask) {
1352-
if (msp_rx_buf[13+g_boxCamera2_page] & g_boxCamera2_mask) {
1350+
if (msp_rx_buf[13 + g_boxCamera2_page] & g_boxCamera2_mask) {
13531351
if (g_camera_switch == SWITCH_TYPE_PCA9557) {
13541352
camSelected = camera_switch(3);
13551353
}
1356-
}
1354+
}
13571355
}
13581356

13591357
if (!camSelected) {
@@ -1546,6 +1544,8 @@ void update_cms_menu(uint16_t roll, uint16_t pitch, uint16_t yaw, uint16_t throt
15461544
vtx_lp = LP_MODE;
15471545
PIT_MODE = PIT_0MW;
15481546
vtx_pit = PIT_0MW;
1547+
vtx_offset = OFFSET_25MW;
1548+
vtx_team_race = TEAM_RACE;
15491549
vtx_shortcut = SHORTCUT;
15501550
if (!SA_lock) {
15511551
save_vtx_param();
@@ -1976,7 +1976,7 @@ void update_vtx_menu_param(uint8_t state) {
19761976
const char *pitString[] = {" OFF", " P1MW", " 0MW"};
19771977
const char *treamRaceString[] = {" OFF", "MODE1", "MODE2"};
19781978
const char *shortcutString[] = {"OPT_A", "OPT_B"};
1979-
const char *cameraTypeString[] = {"UNKNOWN", "RESERVED", "OUTDATED", "MICRO_V1", "MICRO_V2", "NANO_90", "MICRO_V3" };
1979+
const char *cameraTypeString[] = {"UNKNOWN", "RESERVED", "OUTDATED", "MICRO_V1", "MICRO_V2", "NANO_90", "MICRO_V3"};
19801980
const char *cameraSwitchString[] = {"NONE", "DUAL", "TREBLE"};
19811981

19821982
// cursor
@@ -2032,7 +2032,7 @@ void update_vtx_menu_param(uint8_t state) {
20322032

20332033
// camera selection
20342034
osd_buf[13][osd_menu_offset + 10] = '0' + g_camera_id;
2035-
osd_buf[13][osd_menu_offset + 11] = (g_manual_camera_sel) ? 'M' : ' ';
2035+
osd_buf[13][osd_menu_offset + 11] = (g_manual_camera_sel) ? 'M' : ' ';
20362036
strcpy(osd_buf[13] + osd_menu_offset + 13, cameraTypeString[camera_type]);
20372037

20382038
strcpy(osd_buf[16] + osd_menu_offset + 13, parseLifeTime());

0 commit comments

Comments
 (0)