This commit is contained in:
J. Nick Koston 2023-06-09 15:20:01 -05:00
parent 8f64541823
commit 1fb5fef247
No known key found for this signature in database
2 changed files with 30 additions and 30 deletions

View File

@ -130,7 +130,7 @@ namespace ratgdo {
} }
} }
void RATGDOComponent::getRollingCode(command command) void RATGDOComponent::getRollingCode(cmd command)
{ {
uint64_t id = 0x539; uint64_t id = 0x539;
@ -384,7 +384,7 @@ namespace ratgdo {
* The opener requires a specific duration low/high pulse before it will accept * The opener requires a specific duration low/high pulse before it will accept
* a message * a message
*/ */
void RATGDOComponent::transmit(command command) void RATGDOComponent::transmit(cmd command)
{ {
getRollingCode(command); getRollingCode(command);
this->output_gdo_pin_->digital_write(true); // pull the line high for 1305 micros so the this->output_gdo_pin_->digital_write(true); // pull the line high for 1305 micros so the
@ -509,7 +509,7 @@ namespace ratgdo {
sendCommandAndSaveCounter(Command.LOCK); sendCommandAndSaveCounter(Command.LOCK);
} }
void RATGDOComponent::sendCommandAndSaveCounter(command command) void RATGDOComponent::sendCommandAndSaveCounter(cmd command)
{ {
transmit(command); transmit(command);
this->pref_.save(&this->rollingCodeCounter); this->pref_.save(&this->rollingCodeCounter);

View File

@ -36,36 +36,36 @@ namespace ratgdo {
typedef struct { typedef struct {
uint64_t fixed; uint64_t fixed;
uint32_t data; uint32_t data;
inline bool operator!=(const command& cmd) const inline bool operator!=(const cmd& cmd) const
{ {
return (fixed != cmd.fixed || data != cmd.data); return (fixed != cmd.fixed || data != cmd.data);
} }
} command; } cmd;
typedef struct { typedef struct {
command REBOOT1; cmd REBOOT1;
command REBOOT2; cmd REBOOT2;
command REBOOT3; cmd REBOOT3;
command REBOOT4; cmd REBOOT4;
command REBOOT5; cmd REBOOT5;
command REBOOT6; cmd REBOOT6;
command DOOR1; cmd DOOR1;
command DOOR2; cmd DOOR2;
command LIGHT; cmd LIGHT;
command LOCK; cmd LOCK;
} commands; } cmds;
const commands Command = { const cmds Command = {
.REBOOT1 = (command) { 0x400000000, 0x0000618b }, .REBOOT1 = (cmd) { 0x400000000, 0x0000618b },
.REBOOT2 = (command) { 0, 0x01009080 }, .REBOOT2 = (cmd) { 0, 0x01009080 },
.REBOOT3 = (command) { 0, 0x0000b1a0 }, .REBOOT3 = (cmd) { 0, 0x0000b1a0 },
.REBOOT4 = (command) { 0, 0x01009080 }, .REBOOT4 = (cmd) { 0, 0x01009080 },
.REBOOT5 = (command) { 0x300000000, 0x00008092 }, .REBOOT5 = (cmd) { 0x300000000, 0x00008092 },
.REBOOT6 = (command) { 0x300000000, 0x00008092 }, .REBOOT6 = (cmd) { 0x300000000, 0x00008092 },
.DOOR1 = (command) { 0x200000000, 0x01018280 }, .DOOR1 = (cmd) { 0x200000000, 0x01018280 },
.DOOR2 = (command) { 0x200000000, 0x01009280 }, .DOOR2 = (cmd) { 0x200000000, 0x01009280 },
.LIGHT = (command) { 0x200000000, 0x00009281 }, .LIGHT = (cmd) { 0x200000000, 0x00009281 },
.LOCK = (command) { 0x0100000000, 0x0000728c }, .LOCK = (cmd) { 0x0100000000, 0x0000728c },
}; };
struct RATGDOStore { struct RATGDOStore {
ISRInternalGPIOPin input_obst; ISRInternalGPIOPin input_obst;
@ -112,7 +112,7 @@ namespace ratgdo {
/********************************** FUNCTION DECLARATION /********************************** FUNCTION DECLARATION
* *****************************************/ * *****************************************/
void transmit(command command); void transmit(cmd command);
void sync(); void sync();
void obstructionLoop(); void obstructionLoop();
@ -140,14 +140,14 @@ namespace ratgdo {
void query(); void query();
void doorStateLoop(); void doorStateLoop();
void printRollingCode(); void printRollingCode();
void getRollingCode(command command); void getRollingCode(cmd command);
void gdoStateLoop(); void gdoStateLoop();
void statusUpdateLoop(); void statusUpdateLoop();
void readRollingCode(bool& isStatus, uint8_t& door, uint8_t& light, uint8_t& lock, uint8_t& motion, uint8_t& obstruction, uint8_t& motor); void readRollingCode(bool& isStatus, uint8_t& door, uint8_t& light, uint8_t& lock, uint8_t& motion, uint8_t& obstruction, uint8_t& motor);
void incrementRollingCodeCounter(); void incrementRollingCodeCounter();
void sendRollingCodeChanged(); void sendRollingCodeChanged();
void setRollingCodeCounter(uint32_t counter); void setRollingCodeCounter(uint32_t counter);
void sendCommandAndSaveCounter(command command); void sendCommandAndSaveCounter(cmd command);
/** Register a child component. */ /** Register a child component. */
void register_child(RATGDOClient* obj); void register_child(RATGDOClient* obj);