30
30
// last 8 bits are inverted from previous 8 bits.
31
31
//
32
32
// Format: SSSSXBXX ssssxbxx DBOQBXXX dboqbxxx
33
- // S - The serial number (Channel) is encoded in the first four bits that were sent.
33
+ // S - The serial number (Channel) is encoded in the first four bits that were sent.
34
34
// x - Unused bits
35
35
// B - Bit 6 is set if the button should be button 9-16, instead of buttons 1-8.
36
36
// DQ - The 1st bit of byte 3 is 1 if DIMMER. (bit 4=0 for BRIGHT, bit 4=1 for DIM)
@@ -119,14 +119,14 @@ void subghz_protocol_decoder_x10_reset(void* context) {
119
119
120
120
bool subghz_protocol_x10_validate (void * context ) {
121
121
furi_assert (context );
122
-
122
+
123
123
SubGhzProtocolDecoderX10 * instance = context ;
124
124
SubGhzBlockDecoder * decoder = & instance -> decoder ;
125
- uint64_t data = decoder -> decode_data ;
125
+ uint64_t data = decoder -> decode_data ;
126
126
127
127
return decoder -> decode_count_bit >= subghz_protocol_x10_const .min_count_bit_for_found &&
128
- ((((data >> 24 ) ^ (data >> 16 )) & 0xFF ) == 0xFF ) &&
129
- ((((data >> 8 ) ^ (data )) & 0xFF ) == 0xFF );
128
+ ((((data >> 24 ) ^ (data >> 16 )) & 0xFF ) == 0xFF ) &&
129
+ ((((data >> 8 ) ^ (data )) & 0xFF ) == 0xFF );
130
130
}
131
131
132
132
void subghz_protocol_decoder_x10_feed (void * context , bool level , uint32_t duration ) {
@@ -152,27 +152,27 @@ void subghz_protocol_decoder_x10_feed(void* context, bool level, uint32_t durati
152
152
break ;
153
153
case X10DecoderStepSaveDuration :
154
154
if (level ) {
155
- if (DURATION_DIFF (duration , subghz_protocol_x10_const .te_short ) <
156
- subghz_protocol_x10_const .te_delta ) {
157
- if (instance -> decoder .decode_count_bit ==
158
- subghz_protocol_x10_const .min_count_bit_for_found ) {
159
- instance -> decoder .parser_step = X10DecoderStepReset ;
160
- if (subghz_protocol_x10_validate (context )) {
161
- FURI_LOG_E (TAG , "Decoded a signal!" );
162
- instance -> generic .data = instance -> decoder .decode_data ;
163
- instance -> generic .data_count_bit = instance -> decoder .decode_count_bit ;
155
+ if (DURATION_DIFF (duration , subghz_protocol_x10_const .te_short ) <
156
+ subghz_protocol_x10_const .te_delta ) {
157
+ if (instance -> decoder .decode_count_bit ==
158
+ subghz_protocol_x10_const .min_count_bit_for_found ) {
159
+ instance -> decoder .parser_step = X10DecoderStepReset ;
160
+ if (subghz_protocol_x10_validate (context )) {
161
+ FURI_LOG_E (TAG , "Decoded a signal!" );
162
+ instance -> generic .data = instance -> decoder .decode_data ;
163
+ instance -> generic .data_count_bit = instance -> decoder .decode_count_bit ;
164
164
165
- if (instance -> base .callback )
166
- instance -> base .callback (& instance -> base , instance -> base .context );
167
- }
168
- subghz_protocol_decoder_x10_reset (context );
169
- } else {
170
- instance -> decoder .te_last = duration ;
171
- instance -> decoder .parser_step = X10DecoderStepCheckDuration ;
172
- }
173
- } else {
174
- subghz_protocol_decoder_x10_reset (context );
175
- }
165
+ if (instance -> base .callback )
166
+ instance -> base .callback (& instance -> base , instance -> base .context );
167
+ }
168
+ subghz_protocol_decoder_x10_reset (context );
169
+ } else {
170
+ instance -> decoder .te_last = duration ;
171
+ instance -> decoder .parser_step = X10DecoderStepCheckDuration ;
172
+ }
173
+ } else {
174
+ subghz_protocol_decoder_x10_reset (context );
175
+ }
176
176
} else {
177
177
subghz_protocol_decoder_x10_reset (context );
178
178
}
@@ -218,7 +218,7 @@ uint8_t subghz_protocol_decoder_x10_get_hash_data(void* context) {
218
218
& instance -> decoder , (instance -> decoder .decode_count_bit / 8 ) + 1 );
219
219
}
220
220
221
- bool subghz_protocol_decoder_x10_serialize (
221
+ SubGhzProtocolStatus subghz_protocol_decoder_x10_serialize (
222
222
void * context ,
223
223
FlipperFormat * flipper_format ,
224
224
SubGhzRadioPreset * preset ) {
@@ -227,7 +227,8 @@ bool subghz_protocol_decoder_x10_serialize(
227
227
return subghz_block_generic_serialize (& instance -> generic , flipper_format , preset );
228
228
}
229
229
230
- bool subghz_protocol_decoder_x10_deserialize (void * context , FlipperFormat * flipper_format ) {
230
+ SubGhzProtocolStatus
231
+ subghz_protocol_decoder_x10_deserialize (void * context , FlipperFormat * flipper_format ) {
231
232
furi_assert (context );
232
233
SubGhzProtocolDecoderX10 * instance = context ;
233
234
bool ret = false;
@@ -236,7 +237,7 @@ bool subghz_protocol_decoder_x10_deserialize(void* context, FlipperFormat* flipp
236
237
break ;
237
238
}
238
239
if (instance -> generic .data_count_bit !=
239
- subghz_protocol_x10_const .min_count_bit_for_found ) {
240
+ subghz_protocol_x10_const .min_count_bit_for_found ) {
240
241
FURI_LOG_E (TAG , "Wrong number of bits in key" );
241
242
break ;
242
243
}
@@ -255,8 +256,8 @@ void subghz_protocol_decoder_x10_get_string(void* context, FuriString* output) {
255
256
256
257
uint32_t code_button = 1 + (
257
258
((instance -> generic .btn & 0x10 ) >> 4 ) |
258
- ((instance -> generic .btn & 0x8 ) >> 2 ) |
259
- ((instance -> generic .btn & 0x40 )>>4 ) |
259
+ ((instance -> generic .btn & 0x8 ) >> 2 ) |
260
+ ((instance -> generic .btn & 0x40 )>>4 ) |
260
261
((instance -> generic .btn & 4 )<<1 ));
261
262
262
263
char * code_action = (instance -> generic .btn & 0x20 ) == 0x20 ? "Off" : "On" ;
0 commit comments