1111#include "lora.h"
1212#include "menu/menu_helpers.h"
1313#include "menu/message_dialog.h"
14+ #include "nvs_settings_lora.h"
1415#include "pax_gfx.h"
1516#include "pax_matrix.h"
1617#include "pax_text.h"
@@ -21,7 +22,10 @@ static const char TAG[] = "LoRa information menu";
2122extern lora_handle_t * lora_get_handle (void );
2223
2324#if defined(CONFIG_BSP_TARGET_TANMATSU ) || defined(CONFIG_BSP_TARGET_KONSOOL )
24- #define FOOTER_LEFT ((gui_element_icontext_t[]){{get_icon(ICON_ESC), "/"}, {get_icon(ICON_F1), "Back"}}), 2
25+ #define FOOTER_LEFT \
26+ ((gui_element_icontext_t[]){ \
27+ {get_icon(ICON_ESC), "/"}, {get_icon(ICON_F1), "Back"}, {get_icon(ICON_F4), "Store offset"}}), \
28+ 3
2529#define FOOTER_RIGHT NULL, 0
2630#define TEXT_FONT pax_font_sky_mono
2731#define TEXT_SIZE 18
@@ -45,7 +49,7 @@ static void render(bool partial, bool icons, size_t num_packets, lora_protocol_l
4549 pax_vec2_t position = menu_calc_position (buffer , theme );
4650
4751 render_base_screen_statusbar (buffer , theme , true, true, true,
48- ((gui_element_icontext_t []){{get_icon (ICON_INFO ), "LoRa information" }}), 1 ,
52+ ((gui_element_icontext_t []){{get_icon (ICON_WORKSPACES ), "LoRa information" }}), 1 ,
4953 FOOTER_LEFT , FOOTER_RIGHT );
5054
5155 char text_buffer [256 ];
@@ -209,6 +213,13 @@ void test_tx(void) {
209213 }
210214}
211215
216+ static void store_offset (void ) {
217+ float applied_frequency_offset = 0 ;
218+ lora_get_frequency_offset (lora_get_handle (), NULL , NULL , & applied_frequency_offset );
219+ nvs_settings_set_lora_offset (applied_frequency_offset );
220+ message_dialog (get_icon (ICON_WORKSPACES ), "LoRa information" , "Frequency offset stored" , "OK" );
221+ }
222+
212223void menu_lora_information (void ) {
213224 QueueHandle_t input_event_queue = NULL ;
214225 ESP_ERROR_CHECK (bsp_input_get_queue (& input_event_queue ));
@@ -257,6 +268,9 @@ void menu_lora_information(void) {
257268 case BSP_INPUT_NAVIGATION_KEY_F1 :
258269 case BSP_INPUT_NAVIGATION_KEY_GAMEPAD_B :
259270 return ;
271+ case BSP_INPUT_NAVIGATION_KEY_F4 :
272+ store_offset ();
273+ break ;
260274 case BSP_INPUT_NAVIGATION_KEY_F6 :
261275 test_tx ();
262276 break ;
0 commit comments