Feature:Intregados

This commit is contained in:
semarnat committed 2026-05-22 16:54:55 -06:00
1 parent c1d1f8c8f2
commit aa6f246490
5 files changed
+8 -6

No files matched your search

-1
View File
@@ -3,5 +3,4 @@
#include "Arduino.h" #include "Arduino.h"
#include <WebSocketsServer.h> #include <WebSocketsServer.h>
extern volatile bool websocket_connected;
void webSocketEvent( uint8_t num, WStype_t type, uint8_t * payload, size_t length ); void webSocketEvent( uint8_t num, WStype_t type, uint8_t * payload, size_t length );
+3
View File
@@ -4,6 +4,9 @@
#include "Network.h" #include "Network.h"
#include <WiFi.h> #include <WiFi.h>
extern volatile bool websocket_connected;
class wifi_conf { class wifi_conf {
private: private:
const char* _ssid; const char* _ssid;
-5
View File
@@ -1,17 +1,12 @@
#include "WebSocketHandler.h" #include "WebSocketHandler.h"
extern volatile bool websocket_connected;
void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) { void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) {
switch(type) { switch(type) {
case WStype_CONNECTED: case WStype_CONNECTED:
websocket_connected = true;
Serial.printf("[%u] Cliente conectado\n", num); Serial.printf("[%u] Cliente conectado\n", num);
break; break;
case WStype_DISCONNECTED: case WStype_DISCONNECTED:
websocket_connected = false;
Serial.printf("[%u] Cliente desconectado\n", num); Serial.printf("[%u] Cliente desconectado\n", num);
break; break;
+4
View File
@@ -1,10 +1,13 @@
#include "WiFiConf.h" #include "WiFiConf.h"
extern volatile bool websocket_connected;
void wifi_conf::handler_WiFi(arduino_event_id_t event, arduino_event_info_t info) { void wifi_conf::handler_WiFi(arduino_event_id_t event, arduino_event_info_t info) {
switch(event){ switch(event){
case ARDUINO_EVENT_WIFI_STA_CONNECTED: case ARDUINO_EVENT_WIFI_STA_CONNECTED:
websocket_connected = true;
Serial.printf("Wi-Fi conectado\n"); Serial.printf("Wi-Fi conectado\n");
break; break;
@@ -13,6 +16,7 @@ void wifi_conf::handler_WiFi(arduino_event_id_t event, arduino_event_info_t info
break; break;
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
websocket_connected = false;
Serial.printf("WiFi: Desconectado\n"); Serial.printf("WiFi: Desconectado\n");
Serial.printf("DEBUG: Reconectando...\n"); Serial.printf("DEBUG: Reconectando...\n");
+1
View File
@@ -71,6 +71,7 @@ void ADCTask(void *parameter){
vTaskDelay(pdMS_TO_TICKS(100)); vTaskDelay(pdMS_TO_TICKS(100));
continue; continue;
} }
const uint32_t count = adc1_3.read(samples_buffer); const uint32_t count = adc1_3.read(samples_buffer);
if (count > 0) { if (count > 0) {
if (xRingbufferSend(bufferHandle, samples_buffer, count * sizeof(uint16_t), pdMS_TO_TICKS(1000)) != pdTRUE) { if (xRingbufferSend(bufferHandle, samples_buffer, count * sizeof(uint16_t), pdMS_TO_TICKS(1000)) != pdTRUE) {