Add basic status flag for flow control

This commit is contained in:
Aadi Desai 2021-06-12 12:50:44 +01:00
parent 88adbdc572
commit 5667ef67f2
2 changed files with 14 additions and 0 deletions

11
Control/include/status.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef CONTROL_STATUS_H
#define CONTROL_STATUS_H
typedef enum {
CS_ERROR = -1,
CS_IDLE,
CS_MOVING,
CS_CHARGING
} ControlStatus_t;
#endif

View file

@ -10,6 +10,7 @@
#include "credentials.h" #include "credentials.h"
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <SPIFFS.h> #include <SPIFFS.h>
#include "status.h"
#pragma endregion #pragma endregion
#pragma region Enable extra debugging info for ESP32 #pragma region Enable extra debugging info for ESP32
@ -37,6 +38,7 @@ Ticker ticker;
#pragma endregion #pragma endregion
#pragma region Global variables #pragma region Global variables
ControlStatus_t Status;
float battery_voltage = 4.0f; float battery_voltage = 4.0f;
int distance_travelled = 0; int distance_travelled = 0;
#pragma endregion #pragma endregion
@ -47,6 +49,7 @@ void setup()
esp_log_level_set("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack esp_log_level_set("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack
esp_log_level_set("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client esp_log_level_set("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client
Status = CS_IDLE;
Serial.begin(115200); // Set up hardware UART0 (Connected to USB port) Serial.begin(115200); // Set up hardware UART0 (Connected to USB port)
Serial1.begin(9600, SERIAL_8N1, RX1pin, TX1pin); // Set up hardware UART1 Serial1.begin(9600, SERIAL_8N1, RX1pin, TX1pin); // Set up hardware UART1
// Set up remaining communication ports here (Energy, Drive, Vision) // Set up remaining communication ports here (Energy, Drive, Vision)