mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-11 00:59:28 +00:00
Add restaurant pager (EV1527-variant) to SubGhzD (#2998)
* Add restaurant pager protocol to SubGhzD receiver EV1527-variant 25-bit OOK PWM decoder for restaurant pager systems (JianTao JT-913 and similar). Decodes system ID, pager address, and function code (buzz/sync). * Show friendly pager details in SubGhzD view
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
|
||||
#ifndef __FPROTO_RESTAURANT_PAGER_H__
|
||||
#define __FPROTO_RESTAURANT_PAGER_H__
|
||||
|
||||
#include "subghzdbase.hpp"
|
||||
|
||||
typedef enum : uint8_t {
|
||||
RestaurantPagerDecoderStepReset = 0,
|
||||
RestaurantPagerDecoderStepSaveDuration,
|
||||
RestaurantPagerDecoderStepCheckDuration,
|
||||
} RestaurantPagerDecoderStep;
|
||||
|
||||
class FProtoSubGhzDRestaurantPager : public FProtoSubGhzDBase {
|
||||
public:
|
||||
FProtoSubGhzDRestaurantPager() {
|
||||
sensorType = FPS_RESTAURANT_PAGER;
|
||||
te_short = 204;
|
||||
te_long = 636;
|
||||
te_delta = 100;
|
||||
min_count_bit_for_found = 25;
|
||||
}
|
||||
|
||||
void feed(bool level, uint32_t duration) {
|
||||
switch (parser_step) {
|
||||
case RestaurantPagerDecoderStepReset:
|
||||
if ((!level) && (DURATION_DIFF(duration, te_short * 36) < te_delta * 36)) {
|
||||
// Found preamble
|
||||
parser_step = RestaurantPagerDecoderStepSaveDuration;
|
||||
decode_data = 0;
|
||||
decode_count_bit = 0;
|
||||
}
|
||||
break;
|
||||
case RestaurantPagerDecoderStepSaveDuration:
|
||||
if (level) {
|
||||
te_last = duration;
|
||||
parser_step = RestaurantPagerDecoderStepCheckDuration;
|
||||
}
|
||||
break;
|
||||
case RestaurantPagerDecoderStepCheckDuration:
|
||||
if (!level) {
|
||||
if (duration >= ((uint32_t)te_long * 2)) {
|
||||
parser_step = RestaurantPagerDecoderStepSaveDuration;
|
||||
if (decode_count_bit == min_count_bit_for_found) {
|
||||
// Skip all-ones preamble frames
|
||||
if ((decode_data >> 1) != 0xFFFFFF) {
|
||||
data_count_bit = decode_count_bit;
|
||||
if (callback) callback(this);
|
||||
}
|
||||
}
|
||||
decode_data = 0;
|
||||
decode_count_bit = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((DURATION_DIFF(te_last, te_short) < te_delta) &&
|
||||
(DURATION_DIFF(duration, te_long) < te_delta * 3)) {
|
||||
subghz_protocol_blocks_add_bit(0);
|
||||
parser_step = RestaurantPagerDecoderStepSaveDuration;
|
||||
} else if (
|
||||
(DURATION_DIFF(te_last, te_long) < te_delta * 3) &&
|
||||
(DURATION_DIFF(duration, te_short) < te_delta)) {
|
||||
subghz_protocol_blocks_add_bit(1);
|
||||
parser_step = RestaurantPagerDecoderStepSaveDuration;
|
||||
} else {
|
||||
parser_step = RestaurantPagerDecoderStepReset;
|
||||
}
|
||||
} else {
|
||||
parser_step = RestaurantPagerDecoderStepReset;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -55,6 +55,7 @@ So include here the .hpp, and add a new element to the protos vector in the cons
|
||||
#include "s-marantec24.hpp"
|
||||
// GENIE FROM PR
|
||||
#include "s-holtek_ht6p20b.hpp"
|
||||
#include "s-restaurant_pager.hpp"
|
||||
|
||||
#ifndef __FPROTO_PROTOLISTSGZ_H__
|
||||
#define __FPROTO_PROTOLISTSGZ_H__
|
||||
@@ -109,6 +110,7 @@ class SubGhzDProtos : public FProtoListGeneral {
|
||||
protos[FPS_GANGQI] = new FProtoSubGhzDGangqi();
|
||||
protos[FPS_MARANTEC24] = new FProtoSubGhzDMarantec24();
|
||||
protos[FPS_HOLTEKHT6P20B] = new FProtoSubGhzDHoltekHt6p20b();
|
||||
protos[FPS_RESTAURANT_PAGER] = new FProtoSubGhzDRestaurantPager();
|
||||
|
||||
for (uint8_t i = 0; i < FPS_COUNT; ++i) {
|
||||
if (protos[i] != NULL) protos[i]->setCallback(callbackTarget);
|
||||
|
||||
@@ -59,6 +59,7 @@ enum FPROTO_SUBGHZD_SENSOR : uint8_t {
|
||||
FPS_GANGQI,
|
||||
FPS_MARANTEC24,
|
||||
FPS_HOLTEKHT6P20B,
|
||||
FPS_RESTAURANT_PAGER,
|
||||
FPS_COUNT
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user