fix: start only enabled links and move config buffers off stack

This commit is contained in:
2026-04-23 00:00:06 +08:00
parent e3450fd0ad
commit eeccfb84a0
3 changed files with 59 additions and 54 deletions
+8 -8
View File
@@ -23,6 +23,8 @@ static device_config_t g_config;
static volatile bool g_reset_requested;
static volatile bool g_uart1_tx_busy;
static uint8_t g_uart1_rx_buffer[CONFIG_RX_BUFFER_SIZE];
static char g_config_cmd_buffer[CONFIG_CMD_MAX_LEN];
static char g_config_response_buffer[CONFIG_TX_BUFFER_SIZE];
static uint32_t config_calc_crc(const device_config_t *cfg)
{
@@ -632,8 +634,6 @@ static void config_respond_to_uart(route_msg_t *msg, const char *response)
void ConfigTask(void *argument)
{
route_msg_t *msg;
char cmd[CONFIG_CMD_MAX_LEN];
char response[CONFIG_TX_BUFFER_SIZE];
at_result_t result;
(void)argument;
@@ -646,14 +646,14 @@ void ConfigTask(void *argument)
continue;
}
if (msg->len >= sizeof(cmd)) {
msg->len = sizeof(cmd) - 1u;
if (msg->len >= sizeof(g_config_cmd_buffer)) {
msg->len = sizeof(g_config_cmd_buffer) - 1u;
}
memcpy(cmd, msg->data, msg->len);
cmd[msg->len] = '\0';
memcpy(g_config_cmd_buffer, msg->data, msg->len);
g_config_cmd_buffer[msg->len] = '\0';
result = config_process_at_cmd(cmd, response, sizeof(response));
config_respond_to_uart(msg, response);
result = config_process_at_cmd(g_config_cmd_buffer, g_config_response_buffer, sizeof(g_config_response_buffer));
config_respond_to_uart(msg, g_config_response_buffer);
if (result == AT_NEED_REBOOT) {
config_respond_to_uart(msg, "Note: Use AT+SAVE then AT+RESET to apply changes\r\n");
}