Skip to content

Commit dfb17ab

Browse files
committed
Revert "Merge pull request #949 from Dmitry422/dev"
This reverts commit ae1abd6, reversing changes made to a8d5743.
1 parent 6789686 commit dfb17ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+81
-256
lines changed

applications/drivers/subghz/cc1101_ext/cc1101_ext.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -794,17 +794,12 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
794794
subghz_device_cc1101_ext->async_tx.buffer =
795795
malloc(SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL * sizeof(uint32_t));
796796

797-
// here we do the same things as in /unleashed-firmware/targets/f7/furi_hal/furi_hal_subghz.c
798-
// use first DMA to update timer TIM17 durations, but TIM17 have not output chanel
799-
// so we use second DMA to transfer data from gpio_tx_buff directly to gpio pin using BSSR.
800-
// BSSR allow us tranfer data directly to pin in gpio port.
801-
802797
//Signal generation with mem-to-mem DMA
803798
furi_hal_gpio_write(subghz_device_cc1101_ext->g0_pin, false);
804799
furi_hal_gpio_init(
805800
subghz_device_cc1101_ext->g0_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
806801

807-
// Configure DMA to update timer TIM17 ARR by durations from buffer
802+
// Configure DMA update timer
808803
LL_DMA_SetMemoryAddress(
809804
SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_DEF, (uint32_t)subghz_device_cc1101_ext->async_tx.buffer);
810805
LL_DMA_SetPeriphAddress(SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_DEF, (uint32_t) & (TIM17->ARR));
@@ -826,7 +821,7 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
826821

827822
furi_hal_bus_enable(FuriHalBusTIM17);
828823

829-
// Configure TIM 17
824+
// Configure TIM
830825
// Set the timer resolution to 2 us
831826
LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP);
832827
LL_TIM_SetClockDivision(TIM17, LL_TIM_CLOCKDIVISION_DIV1);
@@ -840,7 +835,7 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
840835
subghz_device_cc1101_ext_async_tx_refill(
841836
subghz_device_cc1101_ext->async_tx.buffer, SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL);
842837

843-
// Configure DMA to transfer data from gpio_tx_buff directly to gpio pin using BSSR
838+
// Configure tx gpio dma
844839
const GpioPin* gpio = subghz_device_cc1101_ext->g0_pin;
845840

846841
subghz_device_cc1101_ext->async_tx.gpio_tx_buff[0] = (uint32_t)gpio->pin << GPIO_NUMBER;

applications/main/subghz/helpers/subghz_txrx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
234234

235235
SubGhzTxRxStartTxState ret = SubGhzTxRxStartTxStateErrorParserOthers;
236236
FuriString* temp_str = furi_string_alloc();
237+
uint32_t repeat = 200;
237238
do {
238239
if(!flipper_format_rewind(flipper_format)) {
239240
FURI_LOG_E(TAG, "Rewind error");
@@ -243,6 +244,10 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
243244
FURI_LOG_E(TAG, "Missing Protocol");
244245
break;
245246
}
247+
if(!flipper_format_insert_or_update_uint32(flipper_format, "Repeat", &repeat, 1)) {
248+
FURI_LOG_E(TAG, "Unable Repeat");
249+
break;
250+
}
246251
ret = SubGhzTxRxStartTxStateOk;
247252

248253
SubGhzRadioPreset* preset = instance->preset;

applications/main/subghz/scenes/subghz_scene_receiver_info.c

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22

33
#include <lib/subghz/blocks/custom_btn.h>
44

5-
#include "applications/main/subghz/helpers/subghz_txrx_i.h"
6-
75
#define TAG "SubGhzSceneReceiverInfo"
86

9-
static bool tx_stop_called = false;
10-
117
void subghz_scene_receiver_info_callback(GuiButtonType result, InputType type, void* context) {
128
furi_assert(context);
139
SubGhz* subghz = context;
@@ -142,17 +138,8 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
142138
return true;
143139
} else if(event.event == SubGhzCustomEventSceneReceiverInfoTxStop) {
144140
//CC1101 Stop Tx -> Start RX
145-
146-
// if we recieve event to stop tranmission (user release OK button) but
147-
// hardware TX still working now then set flag to stop it after hardware TX will be realy ended
148-
// else stop TX correctly and start RX
149-
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
150-
tx_stop_called = true;
151-
return true;
152-
}
153141
subghz->state_notifications = SubGhzNotificationStateIDLE;
154142

155-
//update screen data
156143
widget_reset(subghz->widget);
157144
subghz_scene_receiver_info_draw_widget(subghz);
158145

@@ -192,57 +179,7 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
192179
}
193180
switch(subghz->state_notifications) {
194181
case SubGhzNotificationStateTx:
195-
// if hardware TX still working at this time so we just blink led and do nothing
196-
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
197-
notification_message(subghz->notifications, &sequence_blink_magenta_10);
198-
return true;
199-
}
200-
// if hardware TX not working now and tx_stop_called = true
201-
// (mean user release OK button early than hardware TX was ended) then we stop TX
202-
if(tx_stop_called) {
203-
tx_stop_called = false;
204-
subghz->state_notifications = SubGhzNotificationStateIDLE;
205-
206-
//update screen data
207-
widget_reset(subghz->widget);
208-
subghz_scene_receiver_info_draw_widget(subghz);
209-
210-
subghz_txrx_stop(subghz->txrx);
211-
212-
// Start RX
213-
if(!scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneDecodeRAW)) {
214-
subghz_txrx_rx_start(subghz->txrx);
215-
216-
subghz_txrx_hopper_unpause(subghz->txrx);
217-
if(!subghz_history_get_text_space_left(subghz->history, NULL)) {
218-
subghz->state_notifications = SubGhzNotificationStateRx;
219-
}
220-
}
221-
return true;
222-
} else {
223-
// if current state == SubGhzNotificationStateTx but hardware TX was ended
224-
// and user still not release OK button then we repeat TX
225-
226-
subghz->state_notifications = SubGhzNotificationStateIDLE;
227-
228-
//update screen data
229-
widget_reset(subghz->widget);
230-
subghz_scene_receiver_info_draw_widget(subghz);
231-
232-
//CC1101 Stop RX -> Start TX
233-
subghz_txrx_hopper_pause(subghz->txrx);
234-
if(!subghz_tx_start(
235-
subghz,
236-
subghz_history_get_raw_data(subghz->history, subghz->idx_menu_chosen))) {
237-
subghz_txrx_rx_start(subghz->txrx);
238-
subghz_txrx_hopper_unpause(subghz->txrx);
239-
subghz->state_notifications = SubGhzNotificationStateRx;
240-
} else {
241-
subghz->state_notifications = SubGhzNotificationStateTx;
242-
}
243-
244-
return true;
245-
}
182+
notification_message(subghz->notifications, &sequence_blink_magenta_10);
246183
break;
247184
case SubGhzNotificationStateRx:
248185
notification_message(subghz->notifications, &sequence_blink_cyan_10);

applications/main/subghz/scenes/subghz_scene_transmitter.c

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
#include <dolphin/dolphin.h>
44

55
#include <lib/subghz/blocks/custom_btn.h>
6-
#include <lib/subghz/devices/devices.c>
7-
8-
#include "applications/main/subghz/helpers/subghz_txrx_i.h"
96

107
#define TAG "SubGhzSceneTransmitter"
118

12-
static bool tx_stop_called = false;
13-
149
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
1510
furi_assert(context);
1611
SubGhz* subghz = context;
@@ -71,7 +66,6 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
7166
SubGhz* subghz = context;
7267
if(event.type == SceneManagerEventTypeCustom) {
7368
if(event.event == SubGhzCustomEventViewTransmitterSendStart) {
74-
// if we recieve event to start transmission (user press OK button) then start/restart TX
7569
subghz->state_notifications = SubGhzNotificationStateIDLE;
7670

7771
if(subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
@@ -81,13 +75,6 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
8175
}
8276
return true;
8377
} else if(event.event == SubGhzCustomEventViewTransmitterSendStop) {
84-
// if we recieve event to stop tranmission (user release OK button) but
85-
// hardware TX still working now then set flag to stop it after hardware TX will be realy ended
86-
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
87-
tx_stop_called = true;
88-
return true;
89-
}
90-
// if hardware TX not working now so just stop TX correctly
9178
subghz->state_notifications = SubGhzNotificationStateIDLE;
9279
subghz_txrx_stop(subghz->txrx);
9380
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
@@ -105,10 +92,6 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
10592
}
10693
return true;
10794
} else if(event.event == SubGhzCustomEventViewTransmitterBack) {
108-
// if user press back button then force stop TX if they was active
109-
if(subghz->state_notifications == SubGhzNotificationStateTx) {
110-
subghz_txrx_stop(subghz->txrx);
111-
}
11295
subghz->state_notifications = SubGhzNotificationStateIDLE;
11396
scene_manager_search_and_switch_to_previous_scene(
11497
subghz->scene_manager, SubGhzSceneStart);
@@ -119,42 +102,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
119102
}
120103
} else if(event.type == SceneManagerEventTypeTick) {
121104
if(subghz->state_notifications == SubGhzNotificationStateTx) {
122-
// if hardware TX still working at this time so we just blink led and do nothing
123-
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
124-
notification_message(subghz->notifications, &sequence_blink_magenta_10);
125-
return true;
126-
}
127-
// if hardware TX not working now and tx_stop_called = true
128-
// (mean user release OK button early than hardware TX was ended) then we stop TX
129-
if(tx_stop_called) {
130-
tx_stop_called = false;
131-
subghz->state_notifications = SubGhzNotificationStateIDLE;
132-
subghz_txrx_stop(subghz->txrx);
133-
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
134-
subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK);
135-
int32_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
136-
furi_hal_subghz_set_rolling_counter_mult(0);
137-
// Calling restore!
138-
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
139-
subghz_txrx_stop(subghz->txrx);
140-
// Calling restore 2nd time special for FAAC SLH!
141-
// TODO: Find better way to restore after custom button is used!!!
142-
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
143-
subghz_txrx_stop(subghz->txrx);
144-
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
145-
}
146-
return true;
147-
} else {
148-
// if current state == SubGhzNotificationStateTx but hardware TX was ended
149-
// and user still not release OK button then we repeat transmission
150-
subghz->state_notifications = SubGhzNotificationStateIDLE;
151-
if(subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
152-
subghz->state_notifications = SubGhzNotificationStateTx;
153-
subghz_scene_transmitter_update_data_show(subghz);
154-
dolphin_deed(DolphinDeedSubGhzSend);
155-
}
156-
return true;
157-
}
105+
notification_message(subghz->notifications, &sequence_blink_magenta_10);
158106
}
159107
return true;
160108
}

lib/subghz/protocols/alutech_at_4n.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void* subghz_protocol_encoder_alutech_at_4n_alloc(SubGhzEnvironment* environment
9494
instance->base.protocol = &subghz_protocol_alutech_at_4n;
9595
instance->generic.protocol_name = instance->base.protocol->name;
9696

97-
instance->encoder.repeat = 3;
97+
instance->encoder.repeat = 10;
9898
instance->encoder.size_upload = 512;
9999
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
100100
instance->encoder.is_running = false;

lib/subghz/protocols/ansonic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ SubGhzProtocolStatus
150150
FURI_LOG_E(TAG, "Deserialize error");
151151
break;
152152
}
153-
154153
// Optional value
155154
flipper_format_read_uint32(
156155
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);

lib/subghz/protocols/beninca_arc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void* subghz_protocol_encoder_beninca_arc_alloc(SubGhzEnvironment* environment)
256256
instance->generic.protocol_name = instance->base.protocol->name;
257257
instance->keystore = subghz_environment_get_keystore(environment);
258258

259-
instance->encoder.repeat = 1;
259+
instance->encoder.repeat = 10;
260260
instance->encoder.size_upload = 800;
261261
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
262262
instance->encoder.is_running = false;

lib/subghz/protocols/bett.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ SubGhzProtocolStatus
169169
FURI_LOG_E(TAG, "Deserialize error");
170170
break;
171171
}
172-
173172
// Optional value
174173
flipper_format_read_uint32(
175174
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);

lib/subghz/protocols/bin_raw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void* subghz_protocol_encoder_bin_raw_alloc(SubGhzEnvironment* environment) {
142142
instance->base.protocol = &subghz_protocol_bin_raw;
143143
instance->generic.protocol_name = instance->base.protocol->name;
144144

145-
instance->encoder.repeat = 3;
145+
instance->encoder.repeat = 10;
146146
instance->encoder.size_upload = BIN_RAW_BUF_DATA_SIZE * 5;
147147
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
148148
instance->data = malloc(instance->encoder.size_upload * sizeof(uint8_t));
@@ -309,7 +309,6 @@ SubGhzProtocolStatus
309309
res = SubGhzProtocolStatusErrorParserOthers;
310310
break;
311311
}
312-
313312
// Optional value
314313
flipper_format_read_uint32(
315314
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);

lib/subghz/protocols/came.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void* subghz_protocol_encoder_came_alloc(SubGhzEnvironment* environment) {
9090
instance->base.protocol = &subghz_protocol_came;
9191
instance->generic.protocol_name = instance->base.protocol->name;
9292

93-
instance->encoder.repeat = 5;
93+
instance->encoder.repeat = 10;
9494
instance->encoder.size_upload = 128;
9595
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
9696
instance->encoder.is_running = false;
@@ -181,7 +181,6 @@ SubGhzProtocolStatus
181181
ret = SubGhzProtocolStatusErrorValueBitCount;
182182
break;
183183
}
184-
185184
// Optional value
186185
flipper_format_read_uint32(
187186
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);

0 commit comments

Comments
 (0)