Skip to content

Commit 34faa49

Browse files
author
Scott Powell
committed
* new CMD_SET_OTHER_PARAMS (38)
1 parent 561d289 commit 34faa49

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/companion_radio/main.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static uint32_t _atoi(const char* sp) {
113113
#define CMD_IMPORT_CONTACT 18
114114
#define CMD_REBOOT 19
115115
#define CMD_GET_BATTERY_VOLTAGE 20
116-
#define CMD_SET_OTHER_PARAMS 21
116+
#define CMD_SET_TUNING_PARAMS 21
117117
#define CMD_DEVICE_QEURY 22
118118
#define CMD_EXPORT_PRIVATE_KEY 23
119119
#define CMD_IMPORT_PRIVATE_KEY 24
@@ -130,6 +130,7 @@ static uint32_t _atoi(const char* sp) {
130130
#define CMD_SIGN_FINISH 35
131131
#define CMD_SEND_TRACE_PATH 36
132132
#define CMD_SET_DEVICE_PIN 37
133+
#define CMD_SET_OTHER_PARAMS 38
133134

134135
#define RESP_CODE_OK 0
135136
#define RESP_CODE_ERR 1
@@ -1184,16 +1185,17 @@ class MyMesh : public BaseChatMesh {
11841185
radio_set_tx_power(_prefs.tx_power_dbm);
11851186
writeOKFrame();
11861187
}
1187-
} else if (cmd_frame[0] == CMD_SET_OTHER_PARAMS) {
1188+
} else if (cmd_frame[0] == CMD_SET_TUNING_PARAMS) {
11881189
int i = 1;
11891190
uint32_t rx, af;
11901191
memcpy(&rx, &cmd_frame[i], 4); i += 4;
11911192
memcpy(&af, &cmd_frame[i], 4); i += 4;
11921193
_prefs.rx_delay_base = ((float)rx) / 1000.0f;
11931194
_prefs.airtime_factor = ((float)af) / 1000.0f;
1194-
if (i < len) {
1195-
_prefs.manual_add_contacts = cmd_frame[i++];
1196-
}
1195+
savePrefs();
1196+
writeOKFrame();
1197+
} else if (cmd_frame[0] == CMD_SET_OTHER_PARAMS) {
1198+
_prefs.manual_add_contacts = cmd_frame[1];
11971199
savePrefs();
11981200
writeOKFrame();
11991201
} else if (cmd_frame[0] == CMD_REBOOT && memcmp(&cmd_frame[1], "reboot", 6) == 0) {

0 commit comments

Comments
 (0)