2025-11-28 18:26:32 -06:00
|
|
|
#ifndef DEFINES_H
|
|
|
|
|
#define DEFINES_H
|
2025-12-28 12:46:10 -06:00
|
|
|
#include "driver/gpio.h"
|
2025-12-31 15:44:48 -06:00
|
|
|
#include "driver/ledc.h"
|
2026-01-03 22:59:36 -06:00
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
|
#include "freertos/event_groups.h"
|
|
|
|
|
#include "freertos/queue.h"
|
|
|
|
|
#include "freertos/semphr.h"
|
|
|
|
|
|
|
|
|
|
// Task priorities
|
|
|
|
|
#define SERVO_TASK_PRIORITY (tskIDLE_PRIORITY + 4) // Highest - real-time control
|
|
|
|
|
#define ENCODER_TASK_PRIORITY (tskIDLE_PRIORITY + 3) // High - encoder processing
|
|
|
|
|
#define SOCKETIO_TASK_PRIORITY (tskIDLE_PRIORITY + 2) // Medium
|
|
|
|
|
#define BLE_TASK_PRIORITY (tskIDLE_PRIORITY + 1) // Low
|
|
|
|
|
#define MAIN_TASK_PRIORITY (tskIDLE_PRIORITY + 1) // Low
|
|
|
|
|
|
|
|
|
|
// Event bits for system events
|
|
|
|
|
#define EVENT_WIFI_CONNECTED BIT0
|
|
|
|
|
#define EVENT_SOCKETIO_CONNECTED BIT1
|
|
|
|
|
#define EVENT_SOCKETIO_DISCONNECTED BIT2
|
|
|
|
|
#define EVENT_CLEAR_CALIB BIT3
|
|
|
|
|
#define EVENT_SAVE_POSITION BIT4
|
|
|
|
|
#define EVENT_BLE_SCAN_REQUEST BIT5
|
|
|
|
|
#define EVENT_BLE_CREDS_RECEIVED BIT6
|
|
|
|
|
#define EVENT_BLE_TOKEN_RECEIVED BIT7
|
|
|
|
|
|
|
|
|
|
// Global synchronization primitives
|
|
|
|
|
extern EventGroupHandle_t g_system_events;
|
|
|
|
|
extern QueueHandle_t g_servo_command_queue;
|
|
|
|
|
extern QueueHandle_t g_encoder_event_queue;
|
|
|
|
|
extern SemaphoreHandle_t g_calibration_mutex;
|
2025-11-28 18:26:32 -06:00
|
|
|
|
|
|
|
|
#define ccwSpeed 6500
|
|
|
|
|
#define cwSpeed 3300
|
|
|
|
|
#define offSpeed 4900
|
|
|
|
|
|
|
|
|
|
#define ccwMax 10
|
|
|
|
|
#define cwMax 0
|
2025-12-28 20:52:11 -06:00
|
|
|
|
2025-12-18 15:01:25 -06:00
|
|
|
#define nvsWiFi "WiFiCreds"
|
|
|
|
|
#define ssidTag "SSID"
|
|
|
|
|
#define passTag "PW"
|
|
|
|
|
#define authTag "AuthMode"
|
|
|
|
|
#define unameTag "UNAME"
|
2025-12-28 20:52:11 -06:00
|
|
|
|
2025-12-18 22:08:07 -06:00
|
|
|
#define nvsAuth "AUTH"
|
|
|
|
|
#define tokenTag "TOKEN"
|
2025-11-28 18:26:32 -06:00
|
|
|
|
2025-12-28 20:52:11 -06:00
|
|
|
#define nvsCalib "CALIB"
|
2025-12-31 15:44:48 -06:00
|
|
|
#define UpTicksTag "UP"
|
|
|
|
|
#define DownTicksTag "DOWN"
|
2025-12-28 20:52:11 -06:00
|
|
|
#define statusTag "STATUS"
|
|
|
|
|
|
2025-12-31 15:44:48 -06:00
|
|
|
#define nvsServo "SERVO"
|
|
|
|
|
#define posTag "POS"
|
|
|
|
|
|
2026-01-07 16:53:50 -06:00
|
|
|
#define secureSrv true
|
|
|
|
|
// #define srvAddr "192.168.1.190:3000"
|
|
|
|
|
#define srvAddr "wahwa.com"
|
2025-12-28 12:46:10 -06:00
|
|
|
|
2026-01-07 16:53:50 -06:00
|
|
|
#define ENCODER_PIN_A GPIO_NUM_23 // d5
|
|
|
|
|
#define ENCODER_PIN_B GPIO_NUM_16 // d6
|
|
|
|
|
|
|
|
|
|
#define InputEnc_PIN_A GPIO_NUM_1 // d1
|
|
|
|
|
#define InputEnc_PIN_B GPIO_NUM_2 // d2
|
2025-12-28 15:31:20 -06:00
|
|
|
|
2025-12-31 15:44:48 -06:00
|
|
|
#define servoPin GPIO_NUM_20
|
|
|
|
|
#define servoLEDCChannel LEDC_CHANNEL_0
|
2025-12-31 17:08:29 -06:00
|
|
|
#define servoSwitch GPIO_NUM_17
|
2025-11-28 18:26:32 -06:00
|
|
|
|
2026-01-07 16:53:50 -06:00
|
|
|
#define debugLED GPIO_NUM_22 // d4
|
|
|
|
|
|
2025-11-28 18:26:32 -06:00
|
|
|
#endif
|