Tracking rolling codes received from real hub
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
|
||||
RFPowerView powerView(RF_CE_PIN, RF_CS_PIN, RF_IRQ_PIN, RF_ID);
|
||||
|
||||
uint8_t lastRollingCode1 = 0x3D;
|
||||
uint8_t lastRollingCode2 = 0x96;
|
||||
|
||||
EspMQTTClient client(
|
||||
SECRET_WIFI_SSID, // Wifi SSID
|
||||
SECRET_WIFI_PASSWORD, // Wifi Password
|
||||
@@ -50,6 +53,12 @@ void loop() {
|
||||
}
|
||||
|
||||
void processPacket(const Packet *packet) {
|
||||
// Update last rolling codes each time a packet from a real hub is detected
|
||||
if (packet->source == 0x0000) {
|
||||
lastRollingCode1 = packet->rollingCode1;
|
||||
lastRollingCode2 = packet->rollingCode2;
|
||||
}
|
||||
|
||||
if (packet->type == PacketType::FIELDS) {
|
||||
FieldsParameters parameters = std::get<FieldsParameters>(packet->parameters);
|
||||
for (size_t i = 0; i < parameters.fields.size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user