mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge branch 'feat/nfc-type-4-final' into mntm-dev
This commit is contained in:
@@ -457,7 +457,7 @@ static bool
|
||||
|
||||
//sort by number of occurrences
|
||||
bool swap = true;
|
||||
while(swap) {
|
||||
while(swap) { //-V1044
|
||||
swap = false;
|
||||
for(size_t i = 1; i < BIN_RAW_SEARCH_CLASSES; i++) {
|
||||
if(classes[i].count > classes[i - 1].count) {
|
||||
@@ -573,7 +573,7 @@ static bool
|
||||
bit_count = 0;
|
||||
|
||||
if(data_markup_ind == BIN_RAW_MAX_MARKUP_COUNT) break;
|
||||
ind &= 0xFFFFFFF8; //jump to the pre whole byte
|
||||
ind &= 0xFFFFFFF8; //jump to the pre whole byte //-V784
|
||||
}
|
||||
} while(gap_ind != 0);
|
||||
if((data_markup_ind != BIN_RAW_MAX_MARKUP_COUNT) && (ind != 0)) {
|
||||
|
||||
@@ -262,6 +262,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_came_twee_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_came_twee_get_upload(instance);
|
||||
instance->encoder.front = 0; // reset position before start
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -271,6 +272,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_came_twee_stop(void* context) {
|
||||
SubGhzProtocolEncoderCameTwee* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_came_twee_yield(void* context) {
|
||||
|
||||
@@ -169,6 +169,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_feron_check_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_feron_get_upload(instance);
|
||||
instance->encoder.front = 0;
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -178,6 +179,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_feron_stop(void* context) {
|
||||
SubGhzProtocolEncoderFeron* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_feron_yield(void* context) {
|
||||
|
||||
@@ -80,7 +80,7 @@ void* subghz_protocol_encoder_gangqi_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.size_upload = 1024;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
return instance;
|
||||
@@ -183,35 +183,40 @@ static void subghz_protocol_encoder_gangqi_get_upload(SubGhzProtocolEncoderGangQ
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
// Send key and GAP between parcels
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(bit_read(instance->generic.data, i - 1)) {
|
||||
// Send bit 1
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_gangqi_const.te_long);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_gangqi_const.te_short * 4 +
|
||||
subghz_protocol_gangqi_const.te_delta);
|
||||
} else {
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_gangqi_const.te_long * 2);
|
||||
|
||||
for(size_t r = 0; r < 5; r++) {
|
||||
// Send key and GAP between parcels
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(bit_read(instance->generic.data, i - 1)) {
|
||||
// Send bit 1
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_gangqi_const.te_short);
|
||||
}
|
||||
} else {
|
||||
// Send bit 0
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_gangqi_const.te_short);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_gangqi_const.te_short * 4 +
|
||||
subghz_protocol_gangqi_const.te_delta);
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_gangqi_const.te_long);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_gangqi_const.te_short * 4 +
|
||||
subghz_protocol_gangqi_const.te_delta);
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_gangqi_const.te_short);
|
||||
}
|
||||
} else {
|
||||
// Send bit 0
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_gangqi_const.te_long);
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_gangqi_const.te_short);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_gangqi_const.te_short * 4 +
|
||||
subghz_protocol_gangqi_const.te_delta);
|
||||
} else {
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_gangqi_const.te_long);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,6 +267,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_gangqi_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_gangqi_get_upload(instance);
|
||||
instance->encoder.front = 0;
|
||||
|
||||
if(!flipper_format_rewind(flipper_format)) {
|
||||
FURI_LOG_E(TAG, "Rewind error");
|
||||
@@ -269,7 +275,7 @@ SubGhzProtocolStatus
|
||||
}
|
||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data >> i * 8) & 0xFF;
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data >> (i * 8)) & 0xFF;
|
||||
}
|
||||
if(!flipper_format_update_hex(flipper_format, "Key", key_data, sizeof(uint64_t))) {
|
||||
FURI_LOG_E(TAG, "Unable to add Key");
|
||||
@@ -285,6 +291,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_gangqi_stop(void* context) {
|
||||
SubGhzProtocolEncoderGangQi* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_gangqi_yield(void* context) {
|
||||
@@ -332,7 +339,7 @@ void subghz_protocol_decoder_gangqi_feed(void* context, bool level, volatile uin
|
||||
switch(instance->decoder.parser_step) {
|
||||
case GangQiDecoderStepReset:
|
||||
if((!level) && (DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_long * 2) <
|
||||
subghz_protocol_gangqi_const.te_delta * 3)) {
|
||||
subghz_protocol_gangqi_const.te_delta * 5)) {
|
||||
//Found GAP
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
@@ -366,19 +373,15 @@ void subghz_protocol_decoder_gangqi_feed(void* context, bool level, volatile uin
|
||||
instance->decoder.parser_step = GangQiDecoderStepSaveDuration;
|
||||
} else if(
|
||||
// End of the key
|
||||
DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short * 4) <
|
||||
subghz_protocol_gangqi_const.te_delta) {
|
||||
DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_long * 2) <
|
||||
subghz_protocol_gangqi_const.te_delta * 5) {
|
||||
//Found next GAP and add bit 0 or 1 (only bit 0 was found on the remotes)
|
||||
if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_gangqi_const.te_short) <
|
||||
subghz_protocol_gangqi_const.te_delta) &&
|
||||
(DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short * 4) <
|
||||
subghz_protocol_gangqi_const.te_delta)) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
|
||||
}
|
||||
if((DURATION_DIFF(instance->decoder.te_last, subghz_protocol_gangqi_const.te_long) <
|
||||
subghz_protocol_gangqi_const.te_delta) &&
|
||||
(DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short * 4) <
|
||||
subghz_protocol_gangqi_const.te_delta)) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
|
||||
}
|
||||
|
||||
@@ -263,6 +263,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_hollarm_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_hollarm_get_upload(instance);
|
||||
instance->encoder.front = 0;
|
||||
|
||||
if(!flipper_format_rewind(flipper_format)) {
|
||||
FURI_LOG_E(TAG, "Rewind error");
|
||||
@@ -270,7 +271,7 @@ SubGhzProtocolStatus
|
||||
}
|
||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data >> i * 8) & 0xFF;
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data >> (i * 8)) & 0xFF;
|
||||
}
|
||||
if(!flipper_format_update_hex(flipper_format, "Key", key_data, sizeof(uint64_t))) {
|
||||
FURI_LOG_E(TAG, "Unable to add Key");
|
||||
@@ -286,6 +287,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_hollarm_stop(void* context) {
|
||||
SubGhzProtocolEncoderHollarm* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_hollarm_yield(void* context) {
|
||||
|
||||
@@ -160,6 +160,7 @@ SubGhzProtocolStatus
|
||||
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
|
||||
|
||||
if(!subghz_protocol_encoder_hormann_get_upload(instance)) {
|
||||
instance->encoder.front = 0; // reset position before start
|
||||
ret = SubGhzProtocolStatusErrorEncoderGetUpload;
|
||||
break;
|
||||
}
|
||||
@@ -172,6 +173,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_hormann_stop(void* context) {
|
||||
SubGhzProtocolEncoderHormann* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_hormann_yield(void* context) {
|
||||
|
||||
@@ -195,6 +195,7 @@ SubGhzProtocolStatus subghz_protocol_encoder_intertechno_v3_deserialize(
|
||||
void subghz_protocol_encoder_intertechno_v3_stop(void* context) {
|
||||
SubGhzProtocolEncoderIntertechno_V3* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_intertechno_v3_yield(void* context) {
|
||||
|
||||
@@ -587,7 +587,7 @@ SubGhzProtocolStatus
|
||||
ret = SubGhzProtocolStatusErrorParserKey;
|
||||
break;
|
||||
}
|
||||
|
||||
instance->encoder.front = 0; // reset before start
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -597,6 +597,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_keeloq_stop(void* context) {
|
||||
SubGhzProtocolEncoderKeeloq* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_keeloq_yield(void* context) {
|
||||
|
||||
@@ -85,7 +85,8 @@ void* subghz_protocol_encoder_legrand_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.size_upload = subghz_protocol_legrand_const.min_count_bit_for_found * 2 + 1;
|
||||
instance->encoder.size_upload =
|
||||
(subghz_protocol_legrand_const.min_count_bit_for_found * 6) * 2 + 2;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
return instance;
|
||||
@@ -106,31 +107,50 @@ void subghz_protocol_encoder_legrand_free(void* context) {
|
||||
static bool subghz_protocol_encoder_legrand_get_upload(SubGhzProtocolEncoderLegrand* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
size_t size_upload = (instance->generic.data_count_bit * 2) + 1;
|
||||
if(size_upload != instance->encoder.size_upload) {
|
||||
FURI_LOG_E(TAG, "Invalid data bit count");
|
||||
return false;
|
||||
}
|
||||
//size_t size_upload = (instance->generic.data_count_bit * 2) + 1;
|
||||
//if(size_upload != instance->encoder.size_upload) {
|
||||
// FURI_LOG_E(TAG, "Invalid data bit count");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
// Send sync
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)instance->te * 16);
|
||||
|
||||
// Send key data
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(bit_read(instance->generic.data, i - 1)) {
|
||||
// send bit 1
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)instance->te);
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)instance->te * 3);
|
||||
} else {
|
||||
// send bit 0
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)instance->te * 3);
|
||||
instance->encoder.upload[index++] = level_duration_make(true, (uint32_t)instance->te);
|
||||
for(size_t r = 0; r < 5; r++) {
|
||||
// Send sync
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)instance->te * 16); // 5728
|
||||
// Send key data
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(bit_read(instance->generic.data, i - 1)) {
|
||||
// send bit 1
|
||||
if(i == instance->generic.data_count_bit) {
|
||||
//Send first bit
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)instance->te * 3);
|
||||
} else {
|
||||
// send bit 1 regular
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)instance->te);
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)instance->te * 3);
|
||||
}
|
||||
} else {
|
||||
// send bit 0
|
||||
if(i == instance->generic.data_count_bit) {
|
||||
//Send first bit
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)instance->te);
|
||||
} else {
|
||||
// send bit 0 regular
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)instance->te * 3);
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)instance->te);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
instance->encoder.size_upload = index;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -223,7 +243,7 @@ void subghz_protocol_decoder_legrand_feed(void* context, bool level, uint32_t du
|
||||
switch(instance->decoder.parser_step) {
|
||||
case LegrandDecoderStepReset:
|
||||
if(!level && DURATION_DIFF(duration, subghz_protocol_legrand_const.te_short * 16) <
|
||||
subghz_protocol_legrand_const.te_delta * 8) {
|
||||
subghz_protocol_legrand_const.te_delta * 8) { // 6000 +- 1200
|
||||
instance->decoder.parser_step = LegrandDecoderStepFirstBit;
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
|
||||
@@ -172,6 +172,7 @@ SubGhzProtocolStatus
|
||||
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
|
||||
|
||||
if(!subghz_protocol_encoder_magellan_get_upload(instance)) {
|
||||
instance->encoder.front = 0; // reset before start
|
||||
ret = SubGhzProtocolStatusErrorEncoderGetUpload;
|
||||
break;
|
||||
}
|
||||
@@ -184,6 +185,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_magellan_stop(void* context) {
|
||||
SubGhzProtocolEncoderMagellan* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_magellan_yield(void* context) {
|
||||
|
||||
@@ -221,6 +221,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_marantec_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_marantec_get_upload(instance);
|
||||
instance->encoder.front = 0;
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -230,6 +231,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_marantec_stop(void* context) {
|
||||
SubGhzProtocolEncoderMarantec* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_marantec_yield(void* context) {
|
||||
@@ -267,6 +269,7 @@ void subghz_protocol_decoder_marantec_free(void* context) {
|
||||
void subghz_protocol_decoder_marantec_reset(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderMarantec* instance = context;
|
||||
instance->decoder.parser_step = MarantecDecoderStepReset;
|
||||
manchester_advance(
|
||||
instance->manchester_saved_state,
|
||||
ManchesterEventReset,
|
||||
|
||||
@@ -76,7 +76,7 @@ void* subghz_protocol_encoder_marantec24_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.size_upload = 512;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
return instance;
|
||||
@@ -97,36 +97,40 @@ static void
|
||||
subghz_protocol_encoder_marantec24_get_upload(SubGhzProtocolEncoderMarantec24* instance) {
|
||||
furi_assert(instance);
|
||||
size_t index = 0;
|
||||
|
||||
// Send key and GAP
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(bit_read(instance->generic.data, i - 1)) {
|
||||
// Send bit 1
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_marantec24_const.te_short);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_marantec24_const.te_long * 9 +
|
||||
subghz_protocol_marantec24_const.te_short);
|
||||
// Send initial GAP to trigger decoder
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_marantec24_const.te_long * 9);
|
||||
for(size_t r = 0; r < 4; r++) {
|
||||
// Send key and GAP
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(bit_read(instance->generic.data, i - 1)) {
|
||||
// Send bit 1
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_marantec24_const.te_short);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_marantec24_const.te_long * 9 +
|
||||
subghz_protocol_marantec24_const.te_short);
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_marantec24_const.te_long * 2);
|
||||
}
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_marantec24_const.te_long * 2);
|
||||
}
|
||||
} else {
|
||||
// Send bit 0
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_marantec24_const.te_long);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_marantec24_const.te_long * 9 +
|
||||
subghz_protocol_marantec24_const.te_short);
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_marantec24_const.te_short * 3);
|
||||
// Send bit 0
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_marantec24_const.te_long);
|
||||
if(i == 1) {
|
||||
//Send gap if bit was last
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(uint32_t)subghz_protocol_marantec24_const.te_long * 9 +
|
||||
subghz_protocol_marantec24_const.te_short); // 15200
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_marantec24_const.te_short * 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,6 +167,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_marantec24_check_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_marantec24_get_upload(instance);
|
||||
instance->encoder.front = 0; // reset before start
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -172,6 +177,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_marantec24_stop(void* context) {
|
||||
SubGhzProtocolEncoderMarantec24* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_marantec24_yield(void* context) {
|
||||
@@ -233,7 +239,7 @@ void subghz_protocol_decoder_marantec24_feed(void* context, bool level, volatile
|
||||
switch(instance->decoder.parser_step) {
|
||||
case Marantec24DecoderStepReset:
|
||||
if((!level) && (DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 9) <
|
||||
subghz_protocol_marantec24_const.te_delta * 4)) {
|
||||
subghz_protocol_marantec24_const.te_delta * 6)) {
|
||||
//Found GAP
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
@@ -269,7 +275,7 @@ void subghz_protocol_decoder_marantec24_feed(void* context, bool level, volatile
|
||||
} else if(
|
||||
// End of the key
|
||||
DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 9) <
|
||||
subghz_protocol_marantec24_const.te_delta * 4) {
|
||||
subghz_protocol_marantec24_const.te_delta * 6) {
|
||||
//Found next GAP and add bit 0 or 1 (only bit 0 was found on the remotes)
|
||||
if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_marantec24_const.te_long) <
|
||||
|
||||
@@ -214,6 +214,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_power_smart_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_power_smart_get_upload(instance);
|
||||
instance->encoder.front = 0; // reset before start
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -223,6 +224,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_power_smart_stop(void* context) {
|
||||
SubGhzProtocolEncoderPowerSmart* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_power_smart_yield(void* context) {
|
||||
|
||||
@@ -78,7 +78,7 @@ void* subghz_protocol_encoder_revers_rb2_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.size_upload = 1768;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
return instance;
|
||||
@@ -128,27 +128,30 @@ static void
|
||||
furi_assert(instance);
|
||||
size_t index = 0;
|
||||
|
||||
ManchesterEncoderState enc_state;
|
||||
manchester_encoder_reset(&enc_state);
|
||||
ManchesterEncoderResult result;
|
||||
for(size_t r = 0; r < 6; r++) {
|
||||
ManchesterEncoderState enc_state;
|
||||
manchester_encoder_reset(&enc_state);
|
||||
ManchesterEncoderResult result;
|
||||
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(!manchester_encoder_advance(
|
||||
&enc_state, bit_read(instance->generic.data, i - 1), &result)) {
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(!manchester_encoder_advance(
|
||||
&enc_state, bit_read(instance->generic.data, i - 1), &result)) {
|
||||
instance->encoder.upload[index++] =
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(result);
|
||||
manchester_encoder_advance(
|
||||
&enc_state, bit_read(instance->generic.data, i - 1), &result);
|
||||
}
|
||||
instance->encoder.upload[index++] =
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(result);
|
||||
manchester_encoder_advance(
|
||||
&enc_state, bit_read(instance->generic.data, i - 1), &result);
|
||||
}
|
||||
instance->encoder.upload[index++] =
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(result);
|
||||
instance->encoder.upload[index] =
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(
|
||||
manchester_encoder_finish(&enc_state));
|
||||
if(level_duration_get_level(instance->encoder.upload[index])) {
|
||||
index++;
|
||||
}
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)320);
|
||||
}
|
||||
instance->encoder.upload[index] = subghz_protocol_encoder_revers_rb2_add_duration_to_upload(
|
||||
manchester_encoder_finish(&enc_state));
|
||||
if(level_duration_get_level(instance->encoder.upload[index])) {
|
||||
index++;
|
||||
}
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)320);
|
||||
instance->encoder.size_upload = index;
|
||||
}
|
||||
|
||||
@@ -181,6 +184,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_revers_rb2_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_revers_rb2_get_upload(instance);
|
||||
instance->encoder.front = 0;
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -190,6 +194,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_revers_rb2_stop(void* context) {
|
||||
SubGhzProtocolEncoderRevers_RB2* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_revers_rb2_yield(void* context) {
|
||||
@@ -227,6 +232,8 @@ void subghz_protocol_decoder_revers_rb2_free(void* context) {
|
||||
void subghz_protocol_decoder_revers_rb2_reset(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepReset;
|
||||
instance->header_count = 0;
|
||||
manchester_advance(
|
||||
instance->manchester_saved_state,
|
||||
ManchesterEventReset,
|
||||
|
||||
@@ -271,6 +271,7 @@ SubGhzProtocolStatus
|
||||
|
||||
subghz_protocol_roger_check_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_roger_get_upload(instance);
|
||||
instance->encoder.front = 0;
|
||||
|
||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
@@ -290,6 +291,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_roger_stop(void* context) {
|
||||
SubGhzProtocolEncoderRoger* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_roger_yield(void* context) {
|
||||
|
||||
@@ -254,13 +254,8 @@ static void subghz_protocol_scher_khan_check_remote_controller(
|
||||
instance->btn = 0;
|
||||
instance->cnt = 0;
|
||||
break;
|
||||
case 81: //MAGIC CODE PRO / PRO2 Response ???
|
||||
*protocol_name = "MAGIC CODE PRO,\n Response";
|
||||
instance->serial = 0;
|
||||
instance->btn = 0;
|
||||
instance->cnt = 0;
|
||||
break;
|
||||
case 82: //MAGIC CODE PRO / PRO2 Response ???
|
||||
case 81: // MAGIC CODE PRO / PRO2 Response ???
|
||||
case 82: // MAGIC CODE PRO / PRO2 Response ???
|
||||
*protocol_name = "MAGIC CODE PRO,\n Response";
|
||||
instance->serial = 0;
|
||||
instance->btn = 0;
|
||||
|
||||
@@ -580,6 +580,7 @@ SubGhzProtocolStatus
|
||||
break;
|
||||
}
|
||||
|
||||
instance->encoder.front = 0; // reset before start
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
@@ -589,6 +590,7 @@ SubGhzProtocolStatus
|
||||
void subghz_protocol_encoder_secplus_v2_stop(void* context) {
|
||||
SubGhzProtocolEncoderSecPlus_v2* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
instance->encoder.front = 0; // reset position
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_secplus_v2_yield(void* context) {
|
||||
|
||||
@@ -8,7 +8,7 @@ typedef struct {
|
||||
SubGhzProtocolEncoderBase* base;
|
||||
} SubGhzReceiverSlot;
|
||||
|
||||
ARRAY_DEF(SubGhzReceiverSlotArray, SubGhzReceiverSlot, M_POD_OPLIST);
|
||||
ARRAY_DEF(SubGhzReceiverSlotArray, SubGhzReceiverSlot, M_POD_OPLIST); //-V658
|
||||
#define M_OPL_SubGhzReceiverSlotArray_t() ARRAY_OPLIST(SubGhzReceiverSlotArray, M_POD_OPLIST)
|
||||
|
||||
struct SubGhzReceiver {
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef struct {
|
||||
uint16_t type;
|
||||
} SubGhzKey;
|
||||
|
||||
ARRAY_DEF(SubGhzKeyArray, SubGhzKey, M_POD_OPLIST)
|
||||
ARRAY_DEF(SubGhzKeyArray, SubGhzKey, M_POD_OPLIST) //-V658
|
||||
|
||||
#define M_OPL_SubGhzKeyArray_t() ARRAY_OPLIST(SubGhzKeyArray, M_POD_OPLIST)
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ typedef struct {
|
||||
size_t custom_preset_data_size;
|
||||
} SubGhzSettingCustomPresetItem;
|
||||
|
||||
ARRAY_DEF(SubGhzSettingCustomPresetItemArray, SubGhzSettingCustomPresetItem, M_POD_OPLIST)
|
||||
ARRAY_DEF(SubGhzSettingCustomPresetItemArray, SubGhzSettingCustomPresetItem, M_POD_OPLIST) //-V658
|
||||
|
||||
#define M_OPL_SubGhzSettingCustomPresetItemArray_t() \
|
||||
ARRAY_OPLIST(SubGhzSettingCustomPresetItemArray, M_POD_OPLIST)
|
||||
|
||||
Reference in New Issue
Block a user