ESP32_ChinaDieselHeater_Con.../Arduino/SenderTrial2/TxManage.h
rljonesau 9818b33e47 Automatically detects if another controller exists on the blue wire.
If found, it parrots the settings, but allows on/off commands to be inserted by a user.
If no other controller detected, it falls back and delivers our settings each second.

Currently reports all packets to USB, but will move onto Bluetooth delivery of heater data soon.
2018-09-23 16:31:09 +10:00

34 lines
605 B
C++

#include <Arduino.h>
#include "CFrame.h"
class CTxManage
{
public:
CTxManage(int TxEnbPin, USARTClass& serial);
void RequestOn();
void RequestOff();
void Copy(CFrame& ref);
bool isBusy();
void Tick(unsigned long timenow);
void Send(unsigned long timenow, bool self);
void Report();
void begin();
private:
CFrame m_Frame;
bool m_bOnReq;
bool m_bOffReq;
bool m_bTxPending;
bool m_bSelf;
int m_nTxEnbPin;
unsigned long m_nStartTime;
USARTClass& m_Serial;
const int m_nStartDelay = 20;
const int m_nFrameTime = 14;
const int m_nFrontPorch = 2;
void _send();
};