frux-c 2 лет назад
Родитель
Сommit
f1d2786700
3 измененных файлов с 21 добавлено и 0 удалено
  1. 14 0
      scenes/uhf_scene_settings.c
  2. 6 0
      uhf_module.c
  3. 1 0
      uhf_module.h

+ 14 - 0
scenes/uhf_scene_settings.c

@@ -21,6 +21,16 @@ uint8_t uhf_settings_get_module_baudrate_index(M100Module* module) {
     return 0;
     return 0;
 }
 }
 
 
+uint8_t uhf_settings_get_module_power_index(M100Module* module) {
+    uint16_t power = module->transmitting_power;
+    for(uint8_t i = 0; i < sizeof(POWER_DBM); i++) {
+        if(POWER_DBM[i] == power) {
+            return i;
+        }
+    }
+    return 0;
+}
+
 void uhf_scene_settings_on_enter(void* ctx) {
 void uhf_scene_settings_on_enter(void* ctx) {
     furi_assert(ctx != NULL, "ctx is NULL in uhf_scene_settings_on_enter");
     furi_assert(ctx != NULL, "ctx is NULL in uhf_scene_settings_on_enter");
     UHFApp* uhf_app = ctx;
     UHFApp* uhf_app = ctx;
@@ -41,6 +51,10 @@ void uhf_scene_settings_on_enter(void* ctx) {
 
 
     variable_item_set_current_value_text(item, text_buf);
     variable_item_set_current_value_text(item, text_buf);
     variable_item_set_current_value_index(item, value_index);
     variable_item_set_current_value_index(item, value_index);
+
+    item = variable_item_list_add(
+        variable_item_list, "Power(DBM):", sizeof(POWER_DBM), m100_set_power, uhf_module);
+
     view_dispatcher_switch_to_view(uhf_app->view_dispatcher, UHFViewVariableItemList);
     view_dispatcher_switch_to_view(uhf_app->view_dispatcher, UHFViewVariableItemList);
 }
 }
 
 

+ 6 - 0
uhf_module.c

@@ -392,6 +392,12 @@ bool m100_set_freq_hopping(M100Module* module, bool hopping) {
     return true;
     return true;
 }
 }
 
 
+bool m100_set_power(M100Module* module, uint8_t* power) {
+    UNUSED(module);
+    UNUSED(power);
+    return true;
+}
+
 uint32_t m100_get_baudrate(M100Module* module) {
 uint32_t m100_get_baudrate(M100Module* module) {
     return module->baudrate;
     return module->baudrate;
 }
 }

+ 1 - 0
uhf_module.h

@@ -52,6 +52,7 @@ bool m100_set_working_area(M100Module* module, WorkingArea area);
 bool m100_set_working_channel(M100Module* module, WorkingChannel channel);
 bool m100_set_working_channel(M100Module* module, WorkingChannel channel);
 bool m100_set_transmitting_power(M100Module* module, uint16_t power);
 bool m100_set_transmitting_power(M100Module* module, uint16_t power);
 bool m100_set_freq_hopping(M100Module* module, bool hopping);
 bool m100_set_freq_hopping(M100Module* module, bool hopping);
+bool m100_set_power(M100Module* module, uint8_t* power);
 
 
 // gen2 cmds
 // gen2 cmds
 M100ResponseType m100_send_single_poll(M100Module* module, UHFTag* uhf_tag);
 M100ResponseType m100_send_single_poll(M100Module* module, UHFTag* uhf_tag);