mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
work to home
This commit is contained in:
@@ -234,7 +234,6 @@ 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");
|
||||
@@ -244,10 +243,6 @@ 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;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#include <lib/subghz/blocks/custom_btn.h>
|
||||
|
||||
#include <lib/subghz/devices/devices.c>
|
||||
#define TAG "SubGhzSceneTransmitter"
|
||||
|
||||
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
|
||||
@@ -72,25 +72,56 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
subghz->state_notifications = SubGhzNotificationStateTx;
|
||||
subghz_scene_transmitter_update_data_show(subghz);
|
||||
dolphin_deed(DolphinDeedSubGhzSend);
|
||||
|
||||
// #subghz_one_press_send# - keyword to search changes
|
||||
// #start insert#
|
||||
|
||||
// TODO change while condition to subghz_devices_is_async_complete_tx(subghz->txrx->radio_device);
|
||||
// while(
|
||||
// !(furi_hal_subghz_is_async_tx_complete() &&
|
||||
// subghz_device_cc1101_ext_is_async_tx_complete())) {
|
||||
// notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
||||
// }
|
||||
|
||||
while(!furi_hal_subghz_is_async_tx_complete()) {
|
||||
notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
||||
}
|
||||
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);
|
||||
}
|
||||
// #end insert#
|
||||
}
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventViewTransmitterSendStop) {
|
||||
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;
|
||||
// #subghz_one_press_send# - keyword to search changes
|
||||
// } else if(event.event == SubGhzCustomEventViewTransmitterSendStop) {
|
||||
// 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(event.event == SubGhzCustomEventViewTransmitterBack) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#include <lib/subghz/blocks/custom_btn.h>
|
||||
|
||||
#include <applications/drivers/subghz/cc1101_ext/cc1101_ext.h>
|
||||
#include <targets/f7/furi_hal/furi_hal_subghz.h>
|
||||
|
||||
struct SubGhzViewTransmitter {
|
||||
View* view;
|
||||
SubGhzViewTransmitterCallback callback;
|
||||
@@ -155,7 +158,10 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
||||
true);
|
||||
|
||||
if(can_be_sent) {
|
||||
if(event->key == InputKeyOk && event->type == InputTypePress) {
|
||||
// #subghz_one_press_send# - keyword to search changes
|
||||
bool allow_events = furi_hal_subghz_is_async_tx_complete() && subghz_device_cc1101_ext_is_async_tx_complete ();
|
||||
// #
|
||||
if(event->key == InputKeyOk && event->type == InputTypePress && allow_events) {
|
||||
subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK);
|
||||
with_view_model(
|
||||
subghz_transmitter->view,
|
||||
@@ -168,10 +174,11 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
||||
subghz_transmitter->callback(
|
||||
SubGhzCustomEventViewTransmitterSendStart, subghz_transmitter->context);
|
||||
return true;
|
||||
} else if(event->key == InputKeyOk && event->type == InputTypeRelease) {
|
||||
subghz_transmitter->callback(
|
||||
SubGhzCustomEventViewTransmitterSendStop, subghz_transmitter->context);
|
||||
return true;
|
||||
// #subghz_one_press_send# - keyword to search changes
|
||||
// } else if(event->key == InputKeyOk && event->type == InputTypeRelease) {
|
||||
// subghz_transmitter->callback(
|
||||
// SubGhzCustomEventViewTransmitterSendStop, subghz_transmitter->context);
|
||||
// return true;
|
||||
} // Finish "OK" key processing
|
||||
|
||||
if(subghz_custom_btn_is_allowed()) {
|
||||
@@ -189,7 +196,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(event->type == InputTypePress) {
|
||||
if(event->type == InputTypePress && allow_events) {
|
||||
with_view_model(
|
||||
subghz_transmitter->view,
|
||||
SubGhzViewTransmitterModel * model,
|
||||
@@ -209,10 +216,11 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
||||
subghz_transmitter->callback(
|
||||
SubGhzCustomEventViewTransmitterSendStart, subghz_transmitter->context);
|
||||
return true;
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
subghz_transmitter->callback(
|
||||
SubGhzCustomEventViewTransmitterSendStop, subghz_transmitter->context);
|
||||
return true;
|
||||
// #subghz_one_press_send# - keyword to search changes
|
||||
// } else if(event->type == InputTypeRelease) {
|
||||
// subghz_transmitter->callback(
|
||||
// SubGhzCustomEventViewTransmitterSendStop, subghz_transmitter->context);
|
||||
// return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user