SubRem Apps: update

This commit is contained in:
gid9798 2023-06-21 11:24:16 +03:00
parent 7bd0273fd5
commit 1e76c2d840
5 changed files with 21 additions and 14 deletions

View file

@ -84,9 +84,8 @@ SubRemLoadSubState subrem_sub_preset_load(
if(!flipper_format_read_uint32(fff_data_file, "Frequency", &temp_data32, 1)) {
FURI_LOG_W(TAG, "Cannot read frequency. Set default frequency");
sub_preset->freq_preset.frequency = subghz_setting_get_default_frequency(setting);
} else if(!furi_hal_subghz_is_tx_allowed(temp_data32)) {
// TODO
FURI_LOG_E(TAG, "This frequency can only be used for RX");
} else if(!subghz_txrx_radio_device_is_frequecy_valid(txrx, temp_data32)) {
FURI_LOG_E(TAG, "Frequency not supported on chosen radio module");
break;
}
sub_preset->freq_preset.frequency = temp_data32;

View file

@ -167,10 +167,6 @@ static void subghz_txrx_begin(SubGhzTxRx* instance, uint8_t* preset_data) {
static uint32_t subghz_txrx_rx(SubGhzTxRx* instance, uint32_t frequency) {
furi_assert(instance);
// TODO
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
furi_crash("SubGhz: Incorrect RX frequency.");
}
furi_assert(
instance->txrx_state != SubGhzTxRxStateRx && instance->txrx_state != SubGhzTxRxStateSleep);
@ -216,11 +212,8 @@ void subghz_txrx_sleep(SubGhzTxRx* instance) {
static bool subghz_txrx_tx(SubGhzTxRx* instance, uint32_t frequency) {
furi_assert(instance);
// TODO
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
furi_crash("SubGhz: Incorrect TX frequency.");
}
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
subghz_devices_idle(instance->radio_device);
subghz_devices_set_frequency(instance->radio_device, frequency);
@ -637,6 +630,19 @@ bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t f
return subghz_devices_is_frequency_valid(instance->radio_device, frequency);
}
bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t frequency) {
furi_assert(instance);
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
subghz_devices_idle(instance->radio_device);
subghz_devices_set_frequency(instance->radio_device, frequency);
bool ret = subghz_devices_set_tx(instance->radio_device);
subghz_devices_idle(instance->radio_device);
return ret;
}
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state) {
furi_assert(instance);
instance->debug_pin_state = state;

View file

@ -365,6 +365,8 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance);
*/
bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency);
bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t frequency);
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state);
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance);

View file

@ -84,8 +84,8 @@ SubRemLoadSubState subrem_sub_preset_load(
if(!flipper_format_read_uint32(fff_data_file, "Frequency", &temp_data32, 1)) {
FURI_LOG_W(TAG, "Cannot read frequency. Set default frequency");
sub_preset->freq_preset.frequency = subghz_setting_get_default_frequency(setting);
} else if(!furi_hal_subghz_is_tx_allowed(temp_data32)) {
FURI_LOG_E(TAG, "This frequency can only be used for RX");
} else if(!subghz_txrx_radio_device_is_frequecy_valid(txrx, temp_data32)) {
FURI_LOG_E(TAG, "Frequency not supported on chosen radio module");
break;
}
sub_preset->freq_preset.frequency = temp_data32;

View file

@ -80,7 +80,7 @@ bool subrem_scene_remote_on_event(void* context, SceneManagerEvent event) {
} else {
subrem_view_remote_set_state(
app->subrem_remote_view, SubRemViewRemoteStateIdle, 0);
notification_message(app->notifications, &sequence_blink_stop);
notification_message(app->notifications, &sequence_blink_red_100);
}
return true;
} else if(event.event == SubRemCustomEventViewRemoteForcedStop) {