mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-11 09:09:29 +00:00
Add Superrollo (GW60/HCS361) TX and RX (#3290)
keeloqtx: Superrollo 67-bit transmit mode with rolling counter. subghzd: GW60 receive decoder (reports as KeeLoq; manufacturer key read from KEELOQKEYS/MFCODES). The manufacturer key is not included; add a Superrollo entry to MFCODES to enable TX/RX.
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
|
||||
#ifndef __FPROTO_SUPERROLLO_H__
|
||||
#define __FPROTO_SUPERROLLO_H__
|
||||
|
||||
#include "subghzdbase.hpp"
|
||||
|
||||
// Superrollo GW60 (HCS361) 67-bit OOK decoder. Reports FPS_SUPERROLLO; SubGhzD
|
||||
// treats FPS_SUPERROLLO like KeeLoq for decrypt/display (see ui_subghzd.cpp), so
|
||||
// the "Superrollo" keystore key decrypts it while it stays identifiable in logs.
|
||||
|
||||
typedef enum : uint8_t {
|
||||
SuperrolloStepReset = 0,
|
||||
SuperrolloStepPreambleLow,
|
||||
SuperrolloStepSyncLow,
|
||||
SuperrolloStepSaveDuration,
|
||||
SuperrolloStepCheckDuration,
|
||||
} SuperrolloDecoderStep;
|
||||
|
||||
class FProtoSubGhzDSuperrollo : public FProtoSubGhzDBase {
|
||||
public:
|
||||
FProtoSubGhzDSuperrollo() {
|
||||
sensorType = FPS_SUPERROLLO;
|
||||
te_short = 450;
|
||||
te_long = 900;
|
||||
te_delta = 200;
|
||||
min_count_bit_for_found = 64;
|
||||
}
|
||||
|
||||
void feed(bool level, uint32_t duration) {
|
||||
switch (parser_step) {
|
||||
case SuperrolloStepReset:
|
||||
if (level) {
|
||||
if (DURATION_DIFF(duration, te_short) < te_delta) {
|
||||
header_count++;
|
||||
parser_step = SuperrolloStepPreambleLow;
|
||||
} else if (
|
||||
(header_count >= 4) &&
|
||||
(DURATION_DIFF(duration, te_short * 10) < te_delta * 10)) {
|
||||
parser_step = SuperrolloStepSyncLow;
|
||||
} else {
|
||||
header_count = 0;
|
||||
}
|
||||
} else {
|
||||
header_count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SuperrolloStepPreambleLow:
|
||||
if ((!level) && (DURATION_DIFF(duration, te_long) < te_delta)) {
|
||||
parser_step = SuperrolloStepReset;
|
||||
} else {
|
||||
parser_step = SuperrolloStepReset;
|
||||
header_count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SuperrolloStepSyncLow:
|
||||
if ((!level) && (DURATION_DIFF(duration, te_short * 10) < te_delta * 10)) {
|
||||
parser_step = SuperrolloStepSaveDuration;
|
||||
decode_data = 0;
|
||||
decode_count_bit = 0;
|
||||
} else {
|
||||
parser_step = SuperrolloStepReset;
|
||||
header_count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SuperrolloStepSaveDuration:
|
||||
if (level) {
|
||||
te_last = duration;
|
||||
parser_step = SuperrolloStepCheckDuration;
|
||||
} else if (duration >= te_short * 12) {
|
||||
endFrame();
|
||||
}
|
||||
break;
|
||||
|
||||
case SuperrolloStepCheckDuration:
|
||||
if (!level) {
|
||||
if ((DURATION_DIFF(te_last, te_short) < te_delta) &&
|
||||
(DURATION_DIFF(duration, te_long) < te_delta)) {
|
||||
if (decode_count_bit < min_count_bit_for_found)
|
||||
subghz_protocol_blocks_add_bit(1);
|
||||
else
|
||||
decode_count_bit++;
|
||||
parser_step = SuperrolloStepSaveDuration;
|
||||
} else if (
|
||||
(DURATION_DIFF(te_last, te_long) < te_delta) &&
|
||||
(DURATION_DIFF(duration, te_short) < te_delta)) {
|
||||
if (decode_count_bit < min_count_bit_for_found)
|
||||
subghz_protocol_blocks_add_bit(0);
|
||||
else
|
||||
decode_count_bit++;
|
||||
parser_step = SuperrolloStepSaveDuration;
|
||||
} else if (duration >= te_short * 12) {
|
||||
endFrame();
|
||||
} else {
|
||||
parser_step = SuperrolloStepReset;
|
||||
header_count = 0;
|
||||
}
|
||||
} else {
|
||||
parser_step = SuperrolloStepReset;
|
||||
header_count = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t header_count = 0;
|
||||
|
||||
private:
|
||||
void endFrame() {
|
||||
if ((decode_count_bit >= min_count_bit_for_found) &&
|
||||
(decode_count_bit <= min_count_bit_for_found + 3)) {
|
||||
data_count_bit = min_count_bit_for_found;
|
||||
if (callback) callback(this);
|
||||
}
|
||||
parser_step = SuperrolloStepReset;
|
||||
decode_data = 0;
|
||||
decode_count_bit = 0;
|
||||
header_count = 0;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -29,6 +29,7 @@ So include here the .hpp, and add a new element to the protos vector in the cons
|
||||
#include "s-ido.hpp"
|
||||
#include "s-intertechnov3.hpp"
|
||||
#include "s-keeloq.hpp"
|
||||
#include "s-superrollo.hpp"
|
||||
#include "s-kinggates_stylo_4k.hpp"
|
||||
#include "s-linear.hpp"
|
||||
#include "s-linear_delta3.hpp"
|
||||
@@ -85,6 +86,7 @@ class SubGhzDProtos : public FProtoListGeneral {
|
||||
protos[FPS_IDO] = new FProtoSubGhzDIdo();
|
||||
protos[FPS_INTERTECHNOV3] = new FProtoSubGhzDIntertechnoV3();
|
||||
protos[FPS_KEELOQ] = new FProtoSubGhzDKeeLoq();
|
||||
protos[FPS_SUPERROLLO] = new FProtoSubGhzDSuperrollo();
|
||||
protos[FPS_KINGGATESSTYLO4K] = new FProtoSubGhzDKinggatesStylo4K();
|
||||
protos[FPS_LINEAR] = new FProtoSubGhzDLinear();
|
||||
protos[FPS_LINEARDELTA3] = new FProtoSubGhzDLinearDelta3();
|
||||
|
||||
@@ -60,6 +60,7 @@ enum FPROTO_SUBGHZD_SENSOR : uint8_t {
|
||||
FPS_MARANTEC24,
|
||||
FPS_HOLTEKHT6P20B,
|
||||
FPS_RESTAURANT_PAGER,
|
||||
FPS_SUPERROLLO,
|
||||
FPS_COUNT
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user