mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Nero Radio 57bit experimental support
+ encoder improvements and decoder changes Please report if you find any issues with old 56bit systems that was working before this change!
This commit is contained in:
@@ -152,7 +152,7 @@ SubGhzProtocolStatus subghz_block_generic_deserialize_check_count_bit(
|
||||
break;
|
||||
}
|
||||
if(instance->data_count_bit != count_bit) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
FURI_LOG_D(TAG, "Wrong number of bits in key");
|
||||
ret = SubGhzProtocolStatusErrorValueBitCount;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -142,14 +142,22 @@ static bool
|
||||
//send bit 1
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_nero_radio_const.te_long);
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_nero_radio_const.te_short * 37);
|
||||
if(instance->generic.data_count_bit == 57) {
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)1300);
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_nero_radio_const.te_short * 23);
|
||||
}
|
||||
} else {
|
||||
//send bit 0
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_nero_radio_const.te_short);
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_nero_radio_const.te_short * 37);
|
||||
if(instance->generic.data_count_bit == 57) {
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)1300);
|
||||
} else {
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false, (uint32_t)subghz_protocol_nero_radio_const.te_short * 23);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -164,8 +172,14 @@ SubGhzProtocolStatus
|
||||
&instance->generic,
|
||||
flipper_format,
|
||||
subghz_protocol_nero_radio_const.min_count_bit_for_found);
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
|
||||
if((ret == SubGhzProtocolStatusErrorValueBitCount) &&
|
||||
(instance->generic.data_count_bit == 57)) {
|
||||
ret = SubGhzProtocolStatusOk;
|
||||
} else {
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//optional parameter parameter
|
||||
flipper_format_read_uint32(
|
||||
@@ -284,8 +298,7 @@ void subghz_protocol_decoder_nero_radio_feed(void* context, bool level, uint32_t
|
||||
break;
|
||||
case NeroRadioDecoderStepCheckDuration:
|
||||
if(!level) {
|
||||
if(duration >= ((uint32_t)subghz_protocol_nero_radio_const.te_short * 10 +
|
||||
subghz_protocol_nero_radio_const.te_delta * 2)) {
|
||||
if(duration >= ((uint32_t)1250)) {
|
||||
//Found stop bit
|
||||
if(DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_nero_radio_const.te_short) <
|
||||
@@ -298,8 +311,10 @@ void subghz_protocol_decoder_nero_radio_feed(void* context, bool level, uint32_t
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
|
||||
}
|
||||
instance->decoder.parser_step = NeroRadioDecoderStepReset;
|
||||
if(instance->decoder.decode_count_bit ==
|
||||
subghz_protocol_nero_radio_const.min_count_bit_for_found) {
|
||||
if((instance->decoder.decode_count_bit ==
|
||||
subghz_protocol_nero_radio_const.min_count_bit_for_found) ||
|
||||
(instance->decoder.decode_count_bit ==
|
||||
subghz_protocol_nero_radio_const.min_count_bit_for_found + 1)) {
|
||||
instance->generic.data = instance->decoder.decode_data;
|
||||
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
|
||||
|
||||
@@ -356,10 +371,19 @@ SubGhzProtocolStatus
|
||||
subghz_protocol_decoder_nero_radio_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderNeroRadio* instance = context;
|
||||
return subghz_block_generic_deserialize_check_count_bit(
|
||||
SubGhzProtocolStatus stat;
|
||||
|
||||
stat = subghz_block_generic_deserialize_check_count_bit(
|
||||
&instance->generic,
|
||||
flipper_format,
|
||||
subghz_protocol_nero_radio_const.min_count_bit_for_found);
|
||||
|
||||
if((stat == SubGhzProtocolStatusErrorValueBitCount) &&
|
||||
(instance->generic.data_count_bit == 57)) {
|
||||
return SubGhzProtocolStatusOk;
|
||||
} else {
|
||||
return stat;
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_nero_radio_get_string(void* context, FuriString* output) {
|
||||
|
||||
Reference in New Issue
Block a user