-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurtainStepper.h
68 lines (50 loc) · 1.86 KB
/
CurtainStepper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#define DRIVER_STEP_TIME 4
#define DRIVER_STEPS 500
#define EEPROM_SIZE 200
#define TIME_TO_ZERO 290000
#define BTN_PIN 35
#define USE_BTN_ZERO
#define USE_LittleFS
#define USE_UPDATE_OTA
#ifdef __cplusplus
extern "C" {
#endif
uint8_t temprature_sens_read();
#ifdef __cplusplus
}
#endif
uint8_t temprature_sens_read();
char* Curt_host = "curt_stepper";
enum CURT_STATUS {TO_ZERO, STOP, MOVE, CALIBRATE};
CURT_STATUS Curt_Status;
AsyncWebServer server(80);
AsyncWebSocket ws("/ws");
AsyncEventSource events("/events");
DNSServer dns;
#include <FS.h>
#ifdef USE_LittleFS
#pragma message ("USE LITTLEFS")
//#define SPIFFS LITTLEFS
//#include <LITTLEFS.h>
#define SPIFFS LittleFS
#include <LittleFS.h>
#else
#pragma message ("USE SPIFFS")
#include <SPIFFS.h>
#endif
GStepper<STEPPER4WIRE_HALF> stepper(2048, 23, 21, 22, 19);
GButton btn(BTN_PIN);
TaskHandle_t SysTickerTask1 = NULL;
hw_timer_t *timer = NULL;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
volatile bool StepperMoving = false; // Индикатор движущегося шагового двигателя
String jsonstr; // Строка json
volatile byte curt_status; // Текущая позиция шторы
volatile uint16_t time_to_zero;
struct SetupEEPROM {
byte direction; // Направление движения
uint16_t step; // Всего шагов от нулевой позиции
byte use_btn_zero; // Использовать датчик нулевой позиции
byte use_btn_down; // Использовать датчик нижней позиции
};
SetupEEPROM CurtSetup;