This commit is contained in:
HTotoo
2023-12-08 13:32:28 +01:00
parent b45638f9ed
commit 30b4e43794
8 changed files with 22 additions and 7 deletions
@@ -1,6 +1,8 @@
#ifndef __FPROTO_GENERAL_H__
#define __FPROTO_GENERAL_H__
// useful methods for both weather and subghzd
#include <stdint.h>
#include <stddef.h>
@@ -7,6 +7,10 @@ class FProtoListGeneral {
FProtoListGeneral() {}
virtual ~FProtoListGeneral() {}
virtual void feed(bool level, uint32_t duration) = 0;
void setModulation(uint8_t modulation) { modulation_ = modulation; }
protected:
uint8_t modulation_ = 0;
};
#endif
+1 -2
View File
@@ -26,7 +26,7 @@ class FProtoSubGhzDBase {
uint8_t getSensorType() { return sensorType; }
uint32_t getSensorId() { return id; }
FPROTO_SUBGHZD_MODULATION modulation = FPM_AM; // override this, if FM
protected:
// Helper functions to keep it as compatible with flipper as we can, so adding new protos will be easy.
void subghz_protocol_blocks_add_bit(uint8_t bit) {
@@ -37,7 +37,6 @@ class FProtoSubGhzDBase {
// General weather data holder
uint8_t sensorType = FPS_Invalid;
uint32_t id = SD_NO_ID;
FPROTO_SUBGHZD_MODULATION modulation = FPM_AM; // override this, if FM
// inner logic stuff, also for flipper compatibility.
SubGhzDProtocolDecoderBaseRxCallback callback = NULL;
+1 -1
View File
@@ -34,7 +34,7 @@ class SubGhzDProtos : public FProtoListGeneral {
void feed(bool level, uint32_t duration) {
for (const auto& obj : protos) {
obj->feed(level, duration);
if (obj->modulation == modulation_) obj->feed(level, duration);
}
}