diff options
-rw-r--r-- | shared/protocol.c | 5 | ||||
-rw-r--r-- | stm32f091/server.c | 6 | ||||
-rw-r--r-- | stm32f091/setup.c | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/shared/protocol.c b/shared/protocol.c index c6e5ddd..ca0edc4 100644 --- a/shared/protocol.c +++ b/shared/protocol.c @@ -99,7 +99,10 @@ ws_s_protocol_req_parser_state* ws_protocol_req_parser_alloc() { void ws_protocol_req_cmd_init(ws_s_protocol_req_parser_state* state) { state->target = malloc(sizeof(ws_s_protocol_parsed_req_cmd) + sizeof(char*) * state->arg_len); for (unsigned int i = 0; i < state->arg_len; i++) - state->target->argv[i] = malloc(sizeof(char) * (state->args_len[i] + 1)); + state->target->argv[i] = malloc(sizeof(char) * (state->args_len[i] + 1)); // segfaults on 2nd run? + // state->target->argv stays empty according to debugger + // goes to HardFault_Handler on 2nd iteration + // this might be the stm running out of heap memory though i'm not sure state->target->argc = state->arg_len; diff --git a/stm32f091/server.c b/stm32f091/server.c index 1b677c2..7e44774 100644 --- a/stm32f091/server.c +++ b/stm32f091/server.c @@ -16,7 +16,7 @@ static ws_s_server_parser g_ws_server_parser = { .current_channel = 0, .channel_data_length = 0, .channel_data_counter = 0, - .channel_listen_mode = WS_SERVER_CL_DATA_LENGTH, + .channel_listen_mode = WS_SERVER_CL_CHANNEL_ID, }; static ws_s_protocol_req_parser_state* g_ws_protocol_parsers[WS_SERVER_MAX_CHANNELS] = {0}; @@ -101,8 +101,8 @@ void ws_server_req_incoming(uint8_t* data, size_t size) { g_ws_server_parser.channel_data_ignore = true; break; } - g_ws_server_parser.current_channel *= 10; - g_ws_server_parser.current_channel += byte - '0'; // ascii to int + g_ws_server_parser.channel_data_length *= 10; + g_ws_server_parser.channel_data_length += byte - '0'; // ascii to int break; } case WS_SERVER_CL_DATA_READ: { diff --git a/stm32f091/setup.c b/stm32f091/setup.c index 2175ab3..5b6c6a4 100644 --- a/stm32f091/setup.c +++ b/stm32f091/setup.c @@ -90,7 +90,9 @@ void ws_io_setup() { .Pull = GPIO_NOPULL }); + // TODO: remove debug size ws_backlog_alloc(24 * 60); + // ws_backlog_alloc(10); #ifdef WS_ESP8266_WLAN_MAC ws_esp8266_set_mac(); |