This commit is contained in:
j3d1 2022-09-24 07:48:47 +02:00
parent 9c5fb65a90
commit 1263d7836f
6 changed files with 105 additions and 35 deletions

View file

@ -30,7 +30,6 @@ using namespace fiatlux;
#define vTaskDelayMs(ms) vTaskDelay((ms) / portTICK_PERIOD_MS)
const char hex_lookup[] = "0123456789ABCDEF\0\0";
uint16_t voltage_val;
@ -232,8 +231,6 @@ void websocket_task(void *pvParameter) {
vTaskDelete(nullptr);
}
char str[] = "L00000000\n";
/**
* This function is called when websocket frame is received.
*
@ -264,17 +261,9 @@ void websocket_cb(struct tcp_pcb *pcb, char *data, u16_t data_len,
bottom_color.r = data[7];
bottom_color.g = data[6];
bottom_color.b = data[5];
str[0] = 'B';
str[2] = hex_lookup[val & 0xF];
str[1] = hex_lookup[(val >> 4) & 0xF];
str[4] = hex_lookup[(val >> 8) & 0xF];
str[3] = hex_lookup[(val >> 12) & 0xF];
str[6] = hex_lookup[(val >> 16) & 0xF];
str[5] = hex_lookup[(val >> 20) & 0xF];
str[8] = hex_lookup[(val >> 24) & 0xF];
str[7] = hex_lookup[(val >> 28) & 0xF];
//
syslog(str);
syslog("B");
syslog_i32(val);
syslog("\n");
//signal_led(false);
res.cmd = (messages::id) 'B';
res.ret = OK;
@ -285,16 +274,9 @@ void websocket_cb(struct tcp_pcb *pcb, char *data, u16_t data_len,
top_color.r = data[7];
top_color.g = data[6];
top_color.b = data[5];
str[0] = 'T';
str[2] = hex_lookup[val & 0xF];
str[1] = hex_lookup[(val >> 4) & 0xF];
str[4] = hex_lookup[(val >> 8) & 0xF];
str[3] = hex_lookup[(val >> 12) & 0xF];
str[6] = hex_lookup[(val >> 16) & 0xF];
str[5] = hex_lookup[(val >> 20) & 0xF];
str[8] = hex_lookup[(val >> 24) & 0xF];
str[7] = hex_lookup[(val >> 28) & 0xF];
syslog(str);
syslog("B");
syslog_i32(val);
syslog("\n");
//signal_led(false);
res.cmd = (messages::id) 'T';
res.ret = OK;