Moirtz Wagner 20601a7ecd Minor tweaks
-add fontConv
-make rolloPos display current position of (first) selected rollo
-usability enhancements and fixes
-increase max. number of Rollos
-TODO: ADD METHOD TO SAVE DESIRED LOWER END POSITION
2025-11-17 20:55:11 +01:00

51 lines
1.6 KiB
C++

#ifndef TAHOMA_H
#define TAHOMA_H
#include <Arduino.h>
#include <WiFi.h>
#include <iostream>
#include <HTTPClient.h>
#include <Ticker.h>
#include <ArduinoJson.h> // Include the ArduinoJson library for JSON parsing
#define MAX_NUM_DEVICES 11 // Maximum number of devices to fetch
class Tahoma {
public:
typedef union {
uint16_t movement;
struct {
uint16_t position : 8;
uint16_t rotation : 8;
};
} rolloCommand_t;
typedef struct {
String name; // Device name
uint16_t index; // Device URL
bool selected;
} device_t;
// Constructor with hostname and token
// Initializes the Tahoma object with the provided hostname and token
Tahoma(void);
// Destructor
~Tahoma();
uint8_t getMyDevices(bool _force_update=false); // Fetches the device name from the Tahoma system
rolloCommand_t getPos(int8_t deviceIndex=-1);
uint8_t sendMove(uint8_t deviceIndex, uint8_t position, uint8_t rotation);
uint8_t sendfinalRot(uint8_t deviceIndex);
void moveSelected(uint8_t position, uint8_t rotation);
void selectDev(uint8_t i, bool _selected);
bool isDeviceSelected(uint8_t deviceIndex);
void loop(void);
device_t devicelist[MAX_NUM_DEVICES];
uint8_t numDevs{0};
static rolloCommand_t movement[MAX_NUM_DEVICES];
private:
bool checkMovement(uint8_t deviceIndex);
static constexpr char serverURL[]{"http://nas.local/smart/ajax/tahoma.php"}; // Hostname of the Tahoma system
Ticker movementCheckTicker;
// Simulate fetching data from the Tahoma system
};
#endif // TAHOMA_H