@@ -80,7 +80,7 @@ void* subghz_protocol_encoder_gangqi_alloc(SubGhzEnvironment* environment) {
8080 instance -> generic .protocol_name = instance -> base .protocol -> name ;
8181
8282 instance -> encoder .repeat = 3 ;
83- instance -> encoder .size_upload = 1024 ;
83+ instance -> encoder .size_upload = 256 ;
8484 instance -> encoder .upload = malloc (instance -> encoder .size_upload * sizeof (LevelDuration ));
8585 instance -> encoder .is_running = false;
8686 return instance ;
@@ -187,40 +187,35 @@ static void subghz_protocol_encoder_gangqi_get_upload(SubGhzProtocolEncoderGangQ
187187
188188 size_t index = 0 ;
189189
190- instance -> encoder .upload [index ++ ] =
191- level_duration_make (false, (uint32_t )subghz_protocol_gangqi_const .te_long * 2 );
192-
193- for (size_t r = 0 ; r < 5 ; r ++ ) {
194- // Send key and GAP between parcels
195- for (uint8_t i = instance -> generic .data_count_bit ; i > 0 ; i -- ) {
196- if (bit_read (instance -> generic .data , i - 1 )) {
197- // Send bit 1
190+ // Send key and GAP between parcels
191+ for (uint8_t i = instance -> generic .data_count_bit ; i > 0 ; i -- ) {
192+ if (bit_read (instance -> generic .data , i - 1 )) {
193+ // Send bit 1
194+ instance -> encoder .upload [index ++ ] =
195+ level_duration_make (true, (uint32_t )subghz_protocol_gangqi_const .te_long );
196+ if (i == 1 ) {
197+ //Send gap if bit was last
198+ instance -> encoder .upload [index ++ ] = level_duration_make (
199+ false,
200+ (uint32_t )subghz_protocol_gangqi_const .te_short * 4 +
201+ subghz_protocol_gangqi_const .te_delta );
202+ } else {
198203 instance -> encoder .upload [index ++ ] =
199- level_duration_make (true, (uint32_t )subghz_protocol_gangqi_const .te_long );
200- if (i == 1 ) {
201- //Send gap if bit was last
202- instance -> encoder .upload [index ++ ] = level_duration_make (
203- false,
204- (uint32_t )subghz_protocol_gangqi_const .te_short * 4 +
205- subghz_protocol_gangqi_const .te_delta );
206- } else {
207- instance -> encoder .upload [index ++ ] = level_duration_make (
208- false, (uint32_t )subghz_protocol_gangqi_const .te_short );
209- }
204+ level_duration_make (false, (uint32_t )subghz_protocol_gangqi_const .te_short );
205+ }
206+ } else {
207+ // Send bit 0
208+ instance -> encoder .upload [index ++ ] =
209+ level_duration_make (true, (uint32_t )subghz_protocol_gangqi_const .te_short );
210+ if (i == 1 ) {
211+ //Send gap if bit was last
212+ instance -> encoder .upload [index ++ ] = level_duration_make (
213+ false,
214+ (uint32_t )subghz_protocol_gangqi_const .te_short * 4 +
215+ subghz_protocol_gangqi_const .te_delta );
210216 } else {
211- // Send bit 0
212217 instance -> encoder .upload [index ++ ] =
213- level_duration_make (true, (uint32_t )subghz_protocol_gangqi_const .te_short );
214- if (i == 1 ) {
215- //Send gap if bit was last
216- instance -> encoder .upload [index ++ ] = level_duration_make (
217- false,
218- (uint32_t )subghz_protocol_gangqi_const .te_short * 4 +
219- subghz_protocol_gangqi_const .te_delta );
220- } else {
221- instance -> encoder .upload [index ++ ] =
222- level_duration_make (false, (uint32_t )subghz_protocol_gangqi_const .te_long );
223- }
218+ level_duration_make (false, (uint32_t )subghz_protocol_gangqi_const .te_long );
224219 }
225220 }
226221 }
@@ -271,7 +266,6 @@ SubGhzProtocolStatus
271266
272267 subghz_protocol_gangqi_remote_controller (& instance -> generic );
273268 subghz_protocol_encoder_gangqi_get_upload (instance );
274- instance -> encoder .front = 0 ;
275269
276270 if (!flipper_format_rewind (flipper_format )) {
277271 FURI_LOG_E (TAG , "Rewind error" );
@@ -295,7 +289,6 @@ SubGhzProtocolStatus
295289void subghz_protocol_encoder_gangqi_stop (void * context ) {
296290 SubGhzProtocolEncoderGangQi * instance = context ;
297291 instance -> encoder .is_running = false;
298- instance -> encoder .front = 0 ;
299292}
300293
301294LevelDuration subghz_protocol_encoder_gangqi_yield (void * context ) {
@@ -343,7 +336,7 @@ void subghz_protocol_decoder_gangqi_feed(void* context, bool level, volatile uin
343336 switch (instance -> decoder .parser_step ) {
344337 case GangQiDecoderStepReset :
345338 if ((!level ) && (DURATION_DIFF (duration , subghz_protocol_gangqi_const .te_long * 2 ) <
346- subghz_protocol_gangqi_const .te_delta * 5 )) {
339+ subghz_protocol_gangqi_const .te_delta * 3 )) {
347340 //Found GAP
348341 instance -> decoder .decode_data = 0 ;
349342 instance -> decoder .decode_count_bit = 0 ;
@@ -377,8 +370,8 @@ void subghz_protocol_decoder_gangqi_feed(void* context, bool level, volatile uin
377370 instance -> decoder .parser_step = GangQiDecoderStepSaveDuration ;
378371 } else if (
379372 // End of the key
380- DURATION_DIFF (duration , subghz_protocol_gangqi_const .te_long * 2 ) <
381- subghz_protocol_gangqi_const .te_delta * 5 ) {
373+ ( DURATION_DIFF (duration , subghz_protocol_gangqi_const .te_long * 2 ) <
374+ subghz_protocol_gangqi_const .te_delta * 3 ) ) {
382375 //Found next GAP and add bit 0 or 1 (only bit 0 was found on the remotes)
383376 if ((DURATION_DIFF (
384377 instance -> decoder .te_last , subghz_protocol_gangqi_const .te_short ) <
0 commit comments