Bläddra i källkod

Added IR Timing feature

David Lee 1 år sedan
förälder
incheckning
d5256ed583
5 ändrade filer med 14 tillägg och 5 borttagningar
  1. 1 1
      README.md
  2. 1 1
      application.fam
  3. 3 0
      docs/changelog.md
  4. 8 2
      scenes/xremote_scene_ir_timer.c
  5. 1 1
      xremote_i.h

+ 1 - 1
README.md

@@ -4,7 +4,7 @@
 - Infrared working
 - Infrared working
 - SubGhz working
 - SubGhz working
 - Pause working
 - Pause working
-- IR Timing features in development
+- IR Timing features working
 
 
 ## What this is?
 ## What this is?
 This app combines commands used in IR and SubGhz into playlists that can be run with one click
 This app combines commands used in IR and SubGhz into playlists that can be run with one click

+ 1 - 1
application.fam

@@ -6,7 +6,7 @@ App(
     stack_size=3 * 1024,
     stack_size=3 * 1024,
     fap_icon="icons/xremote_10px.png",
     fap_icon="icons/xremote_10px.png",
     fap_icon_assets="icons",
     fap_icon_assets="icons",
-    fap_version="2.0",
+    fap_version="2.1",
     fap_category="Infrared",
     fap_category="Infrared",
     fap_author="Leedave",
     fap_author="Leedave",
     fap_description="One-Click, sends multiple commands",
     fap_description="One-Click, sends multiple commands",

+ 3 - 0
docs/changelog.md

@@ -1,3 +1,6 @@
+## v2.1
+- Added ability to individually set IR Signal time
+
 ## v2.0
 ## v2.0
 - SubGhz Functionality added
 - SubGhz Functionality added
 - Slight change in Storage format to enalbe individual IR timings later (feature request)
 - Slight change in Storage format to enalbe individual IR timings later (feature request)

+ 8 - 2
scenes/xremote_scene_ir_timer.c

@@ -13,14 +13,15 @@ void xremote_scene_ir_timer_on_enter(void* context) {
     size_t enter_name_length = 5;
     size_t enter_name_length = 5;
     char* str = "Transmit in ms (0 - 9999)";
     char* str = "Transmit in ms (0 - 9999)";
     const char* constStr = str;
     const char* constStr = str;
+    CrossRemoteItem* item = xremote_cross_remote_get_item(app->cross_remote, app->edit_item);
     int_input_set_header_text(int_input, constStr);
     int_input_set_header_text(int_input, constStr);
-    snprintf(app->text_store[0], 5, "%u", 5);
+    snprintf(app->text_store[1], 5, "%lu", item->time);
 
 
     int_input_set_result_callback(
     int_input_set_result_callback(
         int_input,
         int_input,
         xremote_scene_ir_timer_callback,
         xremote_scene_ir_timer_callback,
         context,
         context,
-        app->text_store[0],
+        app->text_store[1],
         enter_name_length,
         enter_name_length,
         false);
         false);
 
 
@@ -35,6 +36,11 @@ bool xremote_scene_ir_timer_on_event(void* context, SceneManagerEvent event) {
         scene_manager_previous_scene(app->scene_manager);
         scene_manager_previous_scene(app->scene_manager);
         return true;
         return true;
     } else if(event.type == SceneManagerEventTypeCustom) {
     } else if(event.type == SceneManagerEventTypeCustom) {
+        CrossRemoteItem* item = xremote_cross_remote_get_item(app->cross_remote, app->edit_item);
+        xremote_cross_remote_item_set_time(item, atoi(app->text_store[1]));
+        if (item->time > 9999) {
+            item->time = 9999;
+        }
         //app->first_station = atoi(app->text_store[0]);
         //app->first_station = atoi(app->text_store[0]);
         /*if(app->first_station > app->max_station) {
         /*if(app->first_station > app->max_station) {
             app->first_station = app->max_station;
             app->first_station = app->max_station;

+ 1 - 1
xremote_i.h

@@ -49,7 +49,7 @@
 #define XREMOTE_APP_EXTENSION ".xr"
 #define XREMOTE_APP_EXTENSION ".xr"
 #define XREMOTE_FILE_TYPE "Cross Remote File"
 #define XREMOTE_FILE_TYPE "Cross Remote File"
 #define XREMOTE_FILE_VERSION 1
 #define XREMOTE_FILE_VERSION 1
-#define XREMOTE_TEXT_STORE_NUM 2
+#define XREMOTE_TEXT_STORE_NUM 3
 #define XREMOTE_TEXT_STORE_SIZE 128
 #define XREMOTE_TEXT_STORE_SIZE 128
 #define XREMOTE_MAX_ITEM_NAME_LENGTH 22
 #define XREMOTE_MAX_ITEM_NAME_LENGTH 22
 #define XREMOTE_MAX_REMOTE_NAME_LENGTH 22
 #define XREMOTE_MAX_REMOTE_NAME_LENGTH 22