first commit
This commit is contained in:
64
src/master.h
Normal file
64
src/master.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
// Timer Struktur
|
||||
struct TimerData {
|
||||
unsigned long startTime1 = 0;
|
||||
unsigned long startTime2 = 0;
|
||||
unsigned long endTime1 = 0;
|
||||
unsigned long endTime2 = 0;
|
||||
unsigned long bestTime1 = 0;
|
||||
unsigned long bestTime2 = 0;
|
||||
bool isRunning1 = false;
|
||||
bool isRunning2 = false;
|
||||
unsigned long finishedSince1 = 0;
|
||||
unsigned long finishedSince2 = 0;
|
||||
};
|
||||
|
||||
// Button Konfiguration
|
||||
struct ButtonConfig {
|
||||
uint8_t mac[6];
|
||||
bool isAssigned = false;
|
||||
};
|
||||
|
||||
struct ButtonConfigs {
|
||||
ButtonConfig start1;
|
||||
ButtonConfig stop1;
|
||||
ButtonConfig start2;
|
||||
ButtonConfig stop2;
|
||||
};
|
||||
|
||||
extern const char* firmwareversion;
|
||||
|
||||
// Globale Variablen
|
||||
TimerData timerData;
|
||||
ButtonConfigs buttonConfigs;
|
||||
bool learningMode = false;
|
||||
int learningStep = 0; // 0=Start1, 1=Stop1, 2=Start2, 3=Stop2
|
||||
unsigned long maxTimeBeforeReset = 300000; // 5 Minuten default
|
||||
unsigned long maxTimeDisplay = 20000; // 20 Sekunden Standard (in ms)
|
||||
bool wifimodeAP = false; // AP-Modus deaktiviert
|
||||
|
||||
//Function Declarations
|
||||
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len);
|
||||
void handleLearningMode(const uint8_t* mac);
|
||||
void handleStartLearning();
|
||||
void handleStart1();
|
||||
void handleStop1();
|
||||
void handleStart2();
|
||||
void handleStop2();
|
||||
void checkAutoReset();
|
||||
void saveButtonConfig();
|
||||
void loadButtonConfig();
|
||||
void saveBestTimes();
|
||||
void loadBestTimes();
|
||||
void saveSettings();
|
||||
void loadSettings();
|
||||
void unlearnButton();
|
||||
int checkLicence();
|
||||
String getTimerDataJSON();
|
||||
Reference in New Issue
Block a user