15#include "StaticThreadController.h"
20#include "src/Modules/HempyModule.h"
21#include "src/WirelessCommands_Hempy.h"
47 pinMode(LED_BUILTIN, OUTPUT);
53 struct HempyModuleCommand BlankCommand = {HempyMessages::HempyModuleCommand1};
54 memcpy(
ReceivedMessage, &BlankCommand,
sizeof(
struct HempyModuleCommand));
56 setSyncInterval(3600);
69 logToSerials(F(
"Setup ready, starting loops:"),
true, 0);
76 logToSerials(F(
"(re)Initializing wireless transceiver"),
false, 0);
132 static bool ledStatus;
133 ledStatus = !ledStatus;
134 digitalWrite(LED_BUILTIN, ledStatus);
144 if (timeStatus() != timeSet && ((HempyCommonTemplate *)
ReceivedMessage)->SequenceID == HempyMessages::HempyModuleCommand1)
173 if (ReceivedTime > 0)
175 setTime(ReceivedTime);
void logToSerials(const __FlashStringHelper *ToPrint, bool BreakLine, uint8_t Indent)
< Logging
Settings * loadSettings(bool ResetEEPROM)
Load settings from EEPROM.
constexpr uint8_t WirelessPayloadSize
Size of the wireless packages exchanged with the Main module. Max 32 bytes are supported on nRF24L01+...
constexpr uint8_t WirelessCEPin
nRF24l01+ wireless transmitter CE pin - Pre-connected on RF-Nano
constexpr uint8_t MaxShotTextLength
Default char * buffer length for storing mutiple words. Memory intense!
constexpr uint8_t MaxWordLength
Default char * buffer length for storing a word + null terminator. Memory intense!
constexpr uint16_t MaxLongTextLength
Default char * buffer length for storing a long text. Memory intense!
constexpr uint16_t WirelessReceiveTimeout
(ms) If no packages are received from the Main module over this limit, try reseting the nRF24L01+ wir...
constexpr uint8_t WirelessCSNPin
< nRF24L01+ wireless receiver
constexpr uint8_t WirelessChannel[6]
This needs to be unique and match with the Name of the HempyModule_Web object in the MainModule_Web....
Thread OneSecThread
< Thread initialization
RF24 Wireless(WirelessCEPin, WirelessCSNPin)
char CurrentTime[MaxWordLength]
Buffer for storing current time in text format.
char LongMessage[MaxLongTextLength]
Temp storage for assembling long messages (REST API, MQTT reporting)
uint32_t ReceivedMessageTimestamp
char ShortMessage[MaxShotTextLength]
Temp storage for assembling short text messages (Log entries, Error messages,etc)
uint8_t ReceivedMessage[WirelessPayloadSize]
void InitializeWireless()
Settings * ModuleSettings
HardwareSerial & ArduinoSerial
< Component initialization
bool & Debug
< communicate with SPI devices, with the Arduino as the master device
void heartBeat()
Wireless communication.
struct HempyModuleSettings Hemp1
bool Metric
Switch between Imperial/Metric units. If changed update the default temp and pressure values below to...
bool Debug
Logs debug messages to serial and web outputs.