From aad06fdd431d714e077a38ca606565fff80bf8b3 Mon Sep 17 00:00:00 2001 From: SkorP Date: Wed, 16 Aug 2023 11:04:56 +0400 Subject: [PATCH] SubGhz: fix PVS --- applications/main/subghz/scenes/subghz_scene_radio_setting.c | 4 ++-- applications/main/subghz/scenes/subghz_scene_set_type.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_radio_setting.c b/applications/main/subghz/scenes/subghz_scene_radio_setting.c index 48614b384..1f8e4d83d 100644 --- a/applications/main/subghz/scenes/subghz_scene_radio_setting.c +++ b/applications/main/subghz/scenes/subghz_scene_radio_setting.c @@ -27,12 +27,12 @@ static uint8_t subghz_scene_radio_settings_next_index_connect_ext_device( SubGhz* subghz, uint8_t current_index) { uint8_t index = 0; - for(index = current_index; index < RADIO_DEVICE_COUNT + 1; index++) { + for(index = current_index; index < RADIO_DEVICE_COUNT; index++) { if(subghz_txrx_radio_device_is_external_connected(subghz->txrx, radio_device_name[index])) { break; } } - if(index > RADIO_DEVICE_COUNT) index = 0; + if(index == RADIO_DEVICE_COUNT) index = 0; return index; } diff --git a/applications/main/subghz/scenes/subghz_scene_set_type.c b/applications/main/subghz/scenes/subghz_scene_set_type.c index c624b5b11..8c040cc9c 100644 --- a/applications/main/subghz/scenes/subghz_scene_set_type.c +++ b/applications/main/subghz/scenes/subghz_scene_set_type.c @@ -174,7 +174,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { case SubmenuIndexDoorHan_433_92: generated_protocol = subghz_txrx_gen_keeloq_protocol( subghz->txrx, "AM650", 433920000, "DoorHan", key, 0x2, 0x0003); - if(!generated_protocol) { + if(generated_protocol != SubGhzProtocolStatusOk) { furi_string_set( subghz->error_str, "Function requires\nan SD card with\nfresh databases."); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); @@ -183,7 +183,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { case SubmenuIndexDoorHan_315_00: generated_protocol = subghz_txrx_gen_keeloq_protocol( subghz->txrx, "AM650", 315000000, "DoorHan", key, 0x2, 0x0003); - if(!generated_protocol) { + if(generated_protocol != SubGhzProtocolStatusOk) { furi_string_set( subghz->error_str, "Function requires\nan SD card with\nfresh databases."); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);