Revert "Merge pull request #949 from Dmitry422/dev"

This reverts commit ae1abd6139, reversing
changes made to a8d5743cf6.
This commit is contained in:
MX
2026-01-26 14:14:06 +03:00
parent 6789686e3f
commit dfb17ab428
56 changed files with 81 additions and 256 deletions

View File

@@ -794,17 +794,12 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
subghz_device_cc1101_ext->async_tx.buffer =
malloc(SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL * sizeof(uint32_t));
// here we do the same things as in /unleashed-firmware/targets/f7/furi_hal/furi_hal_subghz.c
// use first DMA to update timer TIM17 durations, but TIM17 have not output chanel
// so we use second DMA to transfer data from gpio_tx_buff directly to gpio pin using BSSR.
// BSSR allow us tranfer data directly to pin in gpio port.
//Signal generation with mem-to-mem DMA
furi_hal_gpio_write(subghz_device_cc1101_ext->g0_pin, false);
furi_hal_gpio_init(
subghz_device_cc1101_ext->g0_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
// Configure DMA to update timer TIM17 ARR by durations from buffer
// Configure DMA update timer
LL_DMA_SetMemoryAddress(
SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_DEF, (uint32_t)subghz_device_cc1101_ext->async_tx.buffer);
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
furi_hal_bus_enable(FuriHalBusTIM17);
// Configure TIM 17
// Configure TIM
// Set the timer resolution to 2 us
LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP);
LL_TIM_SetClockDivision(TIM17, LL_TIM_CLOCKDIVISION_DIV1);
@@ -840,7 +835,7 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
subghz_device_cc1101_ext_async_tx_refill(
subghz_device_cc1101_ext->async_tx.buffer, SUBGHZ_DEVICE_CC1101_EXT_ASYNC_TX_BUFFER_FULL);
// Configure DMA to transfer data from gpio_tx_buff directly to gpio pin using BSSR
// Configure tx gpio dma
const GpioPin* gpio = subghz_device_cc1101_ext->g0_pin;
subghz_device_cc1101_ext->async_tx.gpio_tx_buff[0] = (uint32_t)gpio->pin << GPIO_NUMBER;

View File

@@ -234,6 +234,7 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
SubGhzTxRxStartTxState ret = SubGhzTxRxStartTxStateErrorParserOthers;
FuriString* temp_str = furi_string_alloc();
uint32_t repeat = 200;
do {
if(!flipper_format_rewind(flipper_format)) {
FURI_LOG_E(TAG, "Rewind error");
@@ -243,6 +244,10 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
FURI_LOG_E(TAG, "Missing Protocol");
break;
}
if(!flipper_format_insert_or_update_uint32(flipper_format, "Repeat", &repeat, 1)) {
FURI_LOG_E(TAG, "Unable Repeat");
break;
}
ret = SubGhzTxRxStartTxStateOk;
SubGhzRadioPreset* preset = instance->preset;

View File

@@ -2,12 +2,8 @@
#include <lib/subghz/blocks/custom_btn.h>
#include "applications/main/subghz/helpers/subghz_txrx_i.h"
#define TAG "SubGhzSceneReceiverInfo"
static bool tx_stop_called = false;
void subghz_scene_receiver_info_callback(GuiButtonType result, InputType type, void* context) {
furi_assert(context);
SubGhz* subghz = context;
@@ -142,17 +138,8 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
return true;
} else if(event.event == SubGhzCustomEventSceneReceiverInfoTxStop) {
//CC1101 Stop Tx -> Start RX
// if we recieve event to stop tranmission (user release OK button) but
// hardware TX still working now then set flag to stop it after hardware TX will be realy ended
// else stop TX correctly and start RX
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
tx_stop_called = true;
return true;
}
subghz->state_notifications = SubGhzNotificationStateIDLE;
//update screen data
widget_reset(subghz->widget);
subghz_scene_receiver_info_draw_widget(subghz);
@@ -192,57 +179,7 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
}
switch(subghz->state_notifications) {
case SubGhzNotificationStateTx:
// if hardware TX still working at this time so we just blink led and do nothing
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
notification_message(subghz->notifications, &sequence_blink_magenta_10);
return true;
}
// if hardware TX not working now and tx_stop_called = true
// (mean user release OK button early than hardware TX was ended) then we stop TX
if(tx_stop_called) {
tx_stop_called = false;
subghz->state_notifications = SubGhzNotificationStateIDLE;
//update screen data
widget_reset(subghz->widget);
subghz_scene_receiver_info_draw_widget(subghz);
subghz_txrx_stop(subghz->txrx);
// Start RX
if(!scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneDecodeRAW)) {
subghz_txrx_rx_start(subghz->txrx);
subghz_txrx_hopper_unpause(subghz->txrx);
if(!subghz_history_get_text_space_left(subghz->history, NULL)) {
subghz->state_notifications = SubGhzNotificationStateRx;
}
}
return true;
} else {
// if current state == SubGhzNotificationStateTx but hardware TX was ended
// and user still not release OK button then we repeat TX
subghz->state_notifications = SubGhzNotificationStateIDLE;
//update screen data
widget_reset(subghz->widget);
subghz_scene_receiver_info_draw_widget(subghz);
//CC1101 Stop RX -> Start TX
subghz_txrx_hopper_pause(subghz->txrx);
if(!subghz_tx_start(
subghz,
subghz_history_get_raw_data(subghz->history, subghz->idx_menu_chosen))) {
subghz_txrx_rx_start(subghz->txrx);
subghz_txrx_hopper_unpause(subghz->txrx);
subghz->state_notifications = SubGhzNotificationStateRx;
} else {
subghz->state_notifications = SubGhzNotificationStateTx;
}
return true;
}
notification_message(subghz->notifications, &sequence_blink_magenta_10);
break;
case SubGhzNotificationStateRx:
notification_message(subghz->notifications, &sequence_blink_cyan_10);

View File

@@ -3,14 +3,9 @@
#include <dolphin/dolphin.h>
#include <lib/subghz/blocks/custom_btn.h>
#include <lib/subghz/devices/devices.c>
#include "applications/main/subghz/helpers/subghz_txrx_i.h"
#define TAG "SubGhzSceneTransmitter"
static bool tx_stop_called = false;
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
furi_assert(context);
SubGhz* subghz = context;
@@ -71,7 +66,6 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
SubGhz* subghz = context;
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubGhzCustomEventViewTransmitterSendStart) {
// if we recieve event to start transmission (user press OK button) then start/restart TX
subghz->state_notifications = SubGhzNotificationStateIDLE;
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) {
}
return true;
} else if(event.event == SubGhzCustomEventViewTransmitterSendStop) {
// if we recieve event to stop tranmission (user release OK button) but
// hardware TX still working now then set flag to stop it after hardware TX will be realy ended
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
tx_stop_called = true;
return true;
}
// if hardware TX not working now so just stop TX correctly
subghz->state_notifications = SubGhzNotificationStateIDLE;
subghz_txrx_stop(subghz->txrx);
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
@@ -105,10 +92,6 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
}
return true;
} else if(event.event == SubGhzCustomEventViewTransmitterBack) {
// if user press back button then force stop TX if they was active
if(subghz->state_notifications == SubGhzNotificationStateTx) {
subghz_txrx_stop(subghz->txrx);
}
subghz->state_notifications = SubGhzNotificationStateIDLE;
scene_manager_search_and_switch_to_previous_scene(
subghz->scene_manager, SubGhzSceneStart);
@@ -119,42 +102,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
}
} else if(event.type == SceneManagerEventTypeTick) {
if(subghz->state_notifications == SubGhzNotificationStateTx) {
// if hardware TX still working at this time so we just blink led and do nothing
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
notification_message(subghz->notifications, &sequence_blink_magenta_10);
return true;
}
// if hardware TX not working now and tx_stop_called = true
// (mean user release OK button early than hardware TX was ended) then we stop TX
if(tx_stop_called) {
tx_stop_called = false;
subghz->state_notifications = SubGhzNotificationStateIDLE;
subghz_txrx_stop(subghz->txrx);
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK);
int32_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
furi_hal_subghz_set_rolling_counter_mult(0);
// Calling restore!
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
subghz_txrx_stop(subghz->txrx);
// Calling restore 2nd time special for FAAC SLH!
// TODO: Find better way to restore after custom button is used!!!
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
subghz_txrx_stop(subghz->txrx);
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
}
return true;
} else {
// if current state == SubGhzNotificationStateTx but hardware TX was ended
// and user still not release OK button then we repeat transmission
subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
subghz->state_notifications = SubGhzNotificationStateTx;
subghz_scene_transmitter_update_data_show(subghz);
dolphin_deed(DolphinDeedSubGhzSend);
}
return true;
}
notification_message(subghz->notifications, &sequence_blink_magenta_10);
}
return true;
}