diff options
Diffstat (limited to 'stm32f091')
-rw-r--r-- | stm32f091/consts.h | 5 | ||||
-rw-r--r-- | stm32f091/esp8266.c | 2 | ||||
-rw-r--r-- | stm32f091/readme.md | 3 | ||||
-rw-r--r-- | stm32f091/server.c | 3 | ||||
-rw-r--r-- | stm32f091/todo.md | 28 | ||||
-rw-r--r-- | stm32f091/util.h | 4 | ||||
-rw-r--r-- | stm32f091/wifi.def.h | 7 |
7 files changed, 10 insertions, 42 deletions
diff --git a/stm32f091/consts.h b/stm32f091/consts.h index 3d2ef5a..6d5b8d2 100644 --- a/stm32f091/consts.h +++ b/stm32f091/consts.h @@ -1,9 +1,10 @@ #pragma once -#include "wifi.h" +#include "../shared/wifi.h" +#include "util.h" -#define WS_SERVER_PORT "80" #define WS_SERVER_MAX_CHANNELS 4 +#define WS_SERVER_PORT_STR WS_MTS(WS_SERVER_PORT) #define WS_DMA_RX_BUFFER_SIZE 100 #define WS_DMA_TX_BUFFER_SIZE 1024 diff --git a/stm32f091/esp8266.c b/stm32f091/esp8266.c index 74ec347..8ff9547 100644 --- a/stm32f091/esp8266.c +++ b/stm32f091/esp8266.c @@ -77,7 +77,7 @@ void ws_esp8266_ap_client_mode() { void ws_esp8266_start_tcp_server() { ws_esp8266_send_seq("AT+CIPSERVER=0\r\n"); // stop tcp server (if running) ws_esp8266_send_seq("AT+CIPMUX=1\r\n"); // enable multiplexing (allow multiple connections) - ws_esp8266_send_seq("AT+CIPSERVER=1," WS_SERVER_PORT "\r\n"); // start tcp server + ws_esp8266_send_seq("AT+CIPSERVER=1," WS_SERVER_PORT_STR "\r\n"); // start tcp server } void ws_esp8266_set_mac() { diff --git a/stm32f091/readme.md b/stm32f091/readme.md index d2758b5..e6af60f 100644 --- a/stm32f091/readme.md +++ b/stm32f091/readme.md @@ -3,7 +3,8 @@ - uses make - make sure to initialize the git submodules - all warnings from source files in the lib/ subfolder are hidden -- copy wifi.def.h to wifi.h and edit the network credentials +- copy ../shared/wifi.def.h to ../shared/wifi.h and edit the network + credentials - the initialization code is broken in some way which means that a soft reset is required for the uart dma to work, either (a) press the reset button on the development board after plugging in, or (b) run `st-flash reset` after diff --git a/stm32f091/server.c b/stm32f091/server.c index 112d23a..d69ef1e 100644 --- a/stm32f091/server.c +++ b/stm32f091/server.c @@ -55,9 +55,6 @@ static bool ws_server_is_response(char data, uint8_t* counter, const char* cmd, return false; } -// TODO: next_few_bytes_are assumes that the complete search string is in the -// buffer, so won't work for buffer cutoffs -#define next_few_bytes_are(code) (((i + sizeof(code) - 2) < size) && (strncmp((char*)&data[i], code, sizeof(code) - 1) == 0)) void ws_server_req_incoming(uint8_t* data, size_t size) { #ifdef WS_DBG_PRINT_ESP_OVER_USART2 ws_dbg_set_usart2_tty_color(WS_DBG_TTY_COLOR_RX); diff --git a/stm32f091/todo.md b/stm32f091/todo.md deleted file mode 100644 index 1d42bf8..0000000 --- a/stm32f091/todo.md +++ /dev/null @@ -1,28 +0,0 @@ -# things that have to get fixed before monday - -- [ ] more documentation in header files (for both client and stm code) -- [ ] design/architecture document -- [x] more tests in the test document -- [ ] handle errors from `AT+CIPSEND`, these look like this: - ``` - > AT0,CONNECT - - > +IPD,0,15:last-records 5<0a> - < AT+CIPSEND=0,125 - > AT+CIPSEND=0,125 - - > ERROR - ``` - -## `// TODO:`'s - -- [ ] `sensor.c:24: return (uint8_t) temp_c; //TODO: convert with range -> util.h` -- [ ] `sensor.c:36: return (uint8_t) humidity; //TODO: convert with range -> util.h` -- [ ] `sensor.c:51: return (uint8_t) val; // TODO: convert with range` -- [ ] `server.c:47:// TODO: next_few_bytes_are assumes that the complete search string is in the` -- [ ] `server.c:146: // TODO: buffer overrun protection` -- [ ] `server.c:152:// TODO: refactor this` -- [ ] `server.c:165:// TODO: refactor this` -- [ ] `server.c:174:// TODO: refactor this` -- [ ] `setup.c:95: // TODO: remove debug size` -- [ ] `setup.c:187: .Pin = GPIO_PIN_8|GPIO_PIN_9, //TODO: use #defines in setup.h` diff --git a/stm32f091/util.h b/stm32f091/util.h index 11bee6f..9c15f8b 100644 --- a/stm32f091/util.h +++ b/stm32f091/util.h @@ -8,6 +8,10 @@ #include "setup.h" #include "../shared/util.h" +// macro to string macro's +#define WS_MTS_EXPAND(x) #x +#define WS_MTS(x) WS_MTS_EXPAND(x) + #define WS_DBG_TTY_COLOR_BLK 0x0 #define WS_DBG_TTY_COLOR_RED 0x1 #define WS_DBG_TTY_COLOR_GRN 0x2 diff --git a/stm32f091/wifi.def.h b/stm32f091/wifi.def.h deleted file mode 100644 index 61e1706..0000000 --- a/stm32f091/wifi.def.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#define WS_ESP8266_WLAN_SSID "Test" -#define WS_ESP8266_WLAN_PASSWD "12345678" -// #define WS_ESP8266_WLAN_MAC "f2:9b:89:47:c4:f3" -// #define WS_ESP8266_WLAN_IP "192.168.2.69" - |