Skip to content

Commit

Permalink
Removed MSP/LTM stream to different ports option
Browse files Browse the repository at this point in the history
Was not implemented anyways.
  • Loading branch information
seeul8er committed Mar 9, 2024
1 parent bc199d5 commit 5486b14
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
9 changes: 1 addition & 8 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,7 @@ <h3>Serial</h3>
</div>
</div>
<div id="msp_ltm_div" class="row">
<div class="six columns">
<label for="msp_ltm_port">MSP & LTM to same port</label>
<select id="msp_ltm_port" name="msp_ltm_port" form="settings_form">
<option value="0">No - MSP: 1607 LTM: 1604</option>
<option value="1">Yes - all: 1607</option>
</select>
</div>
<div class="six columns">
<div class="twelve columns">
<label for="ltm_pp">LTM frames per packet</label>
<select id="ltm_pp" name="ltm_pp" form="settings_form">
<option value="1">1</option>
Expand Down
1 change: 0 additions & 1 deletion main/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ extern uint8_t DB_UART_RTS_THRESH;
extern int DB_UART_BAUD_RATE;
extern uint16_t TRANSPARENT_BUF_SIZE;
extern uint8_t LTM_FRAME_NUM_BUFFER; // Number of LTM frames per UDP packet (min = 1; max = 5)
extern uint8_t MSP_LTM_SAMEPORT; // 0 = no (1607 MSP, 1604 LTM); >0 = yes (1604)
extern int station_rssi; // updated when ESP32 is in station mode and connected to an access point

extern uint32_t uart_byte_count;
Expand Down
7 changes: 0 additions & 7 deletions main/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,6 @@ static esp_err_t settings_change_post_handler(httpd_req_t *req) {
json = cJSON_GetObjectItem(root, "ltm_pp");
if (json) LTM_FRAME_NUM_BUFFER = json->valueint;

json = cJSON_GetObjectItem(root, "msp_ltm_port");
if (json && (json->valueint == 0 || json->valueint == 1))
MSP_LTM_SAMEPORT = json->valueint;
else if (json)
ESP_LOGE(REST_TAG, "Only option 0 or 1 are allowed for msp_ltm_port parameter! Not changing!");

json = cJSON_GetObjectItem(root, "ap_ip");
if (json && is_valid_ip4(json->valuestring)) {
strncpy(DEFAULT_AP_IP, json->valuestring, sizeof(DEFAULT_AP_IP) - 1);
Expand Down Expand Up @@ -339,7 +333,6 @@ static esp_err_t settings_data_get_handler(httpd_req_t *req) {
cJSON_AddNumberToObject(root, "baud", DB_UART_BAUD_RATE);
cJSON_AddNumberToObject(root, "telem_proto", SERIAL_PROTOCOL);
cJSON_AddNumberToObject(root, "ltm_pp", LTM_FRAME_NUM_BUFFER);
cJSON_AddNumberToObject(root, "msp_ltm_port", MSP_LTM_SAMEPORT);
cJSON_AddStringToObject(root, "ap_ip", DEFAULT_AP_IP);
const char *sys_info = cJSON_Print(root);
httpd_resp_sendstr(req, sys_info);
Expand Down
11 changes: 4 additions & 7 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ uint8_t DB_UART_RTS_THRESH = 64;
int32_t DB_UART_BAUD_RATE = 57600;
uint16_t TRANSPARENT_BUF_SIZE = 64;
uint8_t LTM_FRAME_NUM_BUFFER = 2;
uint8_t MSP_LTM_SAMEPORT = 0;
int station_rssi = 0;

struct udp_conn_list_t *udp_conn_list;
Expand Down Expand Up @@ -334,10 +333,10 @@ int init_wifi_clientmode() {
void write_settings_to_nvs() {
ESP_LOGI(TAG,
"Trying to save:\nWifi Mode: %i\nssid %s\nwifi_pass %s\nwifi_chan %i\nbaud %liu\ngpio_tx %i\ngpio_rx %i\ngpio_cts %i\ngpio_rts %i\nrts_thresh %i\nproto %i\n"
"trans_pack_size %i\nltm_per_packet %i\nmsp_ltm %i\nap_ip %s",
"trans_pack_size %i\nltm_per_packet %i\nap_ip %s",
DB_WIFI_MODE, DEFAULT_SSID, DEFAULT_PWD, DEFAULT_CHANNEL, DB_UART_BAUD_RATE, DB_UART_PIN_TX, DB_UART_PIN_RX,
DB_UART_PIN_CTS, DB_UART_PIN_RTS, DB_UART_RTS_THRESH,
SERIAL_PROTOCOL, TRANSPARENT_BUF_SIZE, LTM_FRAME_NUM_BUFFER, MSP_LTM_SAMEPORT, DEFAULT_AP_IP);
SERIAL_PROTOCOL, TRANSPARENT_BUF_SIZE, LTM_FRAME_NUM_BUFFER, DEFAULT_AP_IP);
ESP_LOGI(TAG, "Saving to NVS %s", NVS_NAMESPACE);
nvs_handle my_handle;
ESP_ERROR_CHECK(nvs_open(NVS_NAMESPACE, NVS_READWRITE, &my_handle));
Expand All @@ -354,7 +353,6 @@ void write_settings_to_nvs() {
ESP_ERROR_CHECK(nvs_set_u8(my_handle, "proto", SERIAL_PROTOCOL));
ESP_ERROR_CHECK(nvs_set_u16(my_handle, "trans_pack_size", TRANSPARENT_BUF_SIZE));
ESP_ERROR_CHECK(nvs_set_u8(my_handle, "ltm_per_packet", LTM_FRAME_NUM_BUFFER));
ESP_ERROR_CHECK(nvs_set_u8(my_handle, "msp_ltm", MSP_LTM_SAMEPORT));
ESP_ERROR_CHECK(nvs_set_str(my_handle, "ap_ip", DEFAULT_AP_IP));
ESP_ERROR_CHECK(nvs_commit(my_handle));
nvs_close(my_handle);
Expand Down Expand Up @@ -401,17 +399,16 @@ void read_settings_nvs() {
ESP_ERROR_CHECK(nvs_get_u8(my_handle, "proto", &SERIAL_PROTOCOL));
ESP_ERROR_CHECK(nvs_get_u16(my_handle, "trans_pack_size", &TRANSPARENT_BUF_SIZE));
ESP_ERROR_CHECK(nvs_get_u8(my_handle, "ltm_per_packet", &LTM_FRAME_NUM_BUFFER));
ESP_ERROR_CHECK(nvs_get_u8(my_handle, "msp_ltm", &MSP_LTM_SAMEPORT));
nvs_close(my_handle);
free(wifi_pass);
free(ssid);
free(ap_ip);
ESP_LOGI(TAG,
"Stored settings:\nWifi Mode: %i\nssid %s\nwifi_pass %s\nwifi_chan %i\nbaud %liu\ngpio_tx %i\ngpio_rx %i\ngpio_cts %i\n"
"gpio_rts %i\nrts_thresh %i\nproto %i\ntrans_pack_size %i\nltm_per_packet %i\nmsp_ltm %i\nap_ip %s",
"gpio_rts %i\nrts_thresh %i\nproto %i\ntrans_pack_size %i\nltm_per_packet %i\nap_ip %s",
DB_WIFI_MODE, DEFAULT_SSID, DEFAULT_PWD, DEFAULT_CHANNEL, DB_UART_BAUD_RATE, DB_UART_PIN_TX, DB_UART_PIN_RX,
DB_UART_PIN_CTS, DB_UART_PIN_RTS, DB_UART_RTS_THRESH, SERIAL_PROTOCOL, TRANSPARENT_BUF_SIZE,
LTM_FRAME_NUM_BUFFER, MSP_LTM_SAMEPORT, DEFAULT_AP_IP);
LTM_FRAME_NUM_BUFFER, DEFAULT_AP_IP);
}
}

Expand Down

0 comments on commit 5486b14

Please sign in to comment.