mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Revert "Merge pull request #949 from Dmitry422/dev"
This reverts commitae1abd6139, reversing changes made toa8d5743cf6.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user