diff --git a/bathroom-esp32/.vscode/settings.json b/bathroom-esp32/.vscode/settings.json index 6713db9..344ea0e 100755 --- a/bathroom-esp32/.vscode/settings.json +++ b/bathroom-esp32/.vscode/settings.json @@ -12,7 +12,7 @@ "interface/ftdi/esp32_devkitj_v1.cfg", "target/esp32.cfg" ], - "idf.portWin": "COM8", + "idf.portWin": "COM7", "idf.pythonBinPathWin": "C:\\Projects\\Esp32\\espressif\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe", "idf.toolsPathWin": "C:\\Projects\\Esp32\\espressif", "idf.flashType": "UART", diff --git a/bathroom-esp32/.vscode/settings.json b/bathroom-esp32/.vscode/settings.json index 6713db9..344ea0e 100755 --- a/bathroom-esp32/.vscode/settings.json +++ b/bathroom-esp32/.vscode/settings.json @@ -12,7 +12,7 @@ "interface/ftdi/esp32_devkitj_v1.cfg", "target/esp32.cfg" ], - "idf.portWin": "COM8", + "idf.portWin": "COM7", "idf.pythonBinPathWin": "C:\\Projects\\Esp32\\espressif\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe", "idf.toolsPathWin": "C:\\Projects\\Esp32\\espressif", "idf.flashType": "UART", diff --git a/bathroom-esp32/main/main.c b/bathroom-esp32/main/main.c index fa9483a..1a0ce1c 100755 --- a/bathroom-esp32/main/main.c +++ b/bathroom-esp32/main/main.c @@ -37,7 +37,7 @@ /* Use project configuration menu (idf.py menuconfig) to choose the GPIO to blink, or you can edit the following line and set a number here. */ -#define BLINK_GPIO ((gpio_num_t)16) +#define BLINK_GPIO GPIO_NUM_16 #define CONFIG_BLINK_LED_STRIP 1 #define CONFIG_BLINK_LED_STRIP_BACKEND_RMT 1 #define CONFIG_BLINK_PERIOD 500 @@ -173,8 +173,8 @@ wifi_config_t wifi_config = { .sta = { - .ssid = "Test", - .password = "password", + .ssid = "DJArtsGames", + .password = "yubyubechubab", /* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (pasword len => 8). * If you want to connect the device to deprecated WEP/WPA networks, Please set the threshold value * to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with length and format matching to @@ -275,7 +275,7 @@ ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH"); if (output_buffer != NULL) { // Response is accumulated in output_buffer. Uncomment the below line to print the accumulated response - // ESP_LOG_BUFFER_HEX(TAG, output_buffer, output_len); + ESP_LOG_BUFFER_CHAR(TAG, output_buffer, output_len); free(output_buffer); output_buffer = NULL; } @@ -305,6 +305,8 @@ return ESP_OK; } +static char url[300]; + void app_main(void) { //Initialize NVS @@ -317,30 +319,56 @@ configure_wifi(); - esp_http_client_config_t config = { - .url = "https://mattermost.djartsgames.ca/plugins/com.mattermost.bathroom/settings", - .event_handler = _http_event_handler, - }; - esp_http_client_handle_t client = esp_http_client_init(&config); - esp_err_t err = esp_http_client_perform(client); - - if (err == ESP_OK) { - ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %"PRId64, - esp_http_client_get_status_code(client), - esp_http_client_get_content_length(client)); - } else { - ESP_LOGE(TAG, "Error perform http request %s", esp_err_to_name(err)); - } - esp_http_client_cleanup(client); + + //esp_http_client_cleanup(client); /* Configure the peripheral according to the LED type */ configure_led(); + gpio_config_t io_conf = { + .pin_bit_mask = (1ULL<