Browse Source

Fix miss config

Per Mårtensson 2 months ago
parent
commit
49b655631e
2 changed files with 10 additions and 7 deletions
  1. 2 2
      rtl_airband.conf
  2. 8 5
      src/rtl_airband.cpp

+ 2 - 2
rtl_airband.conf

@@ -3,8 +3,8 @@ bel_start_on_time = 30;
 bel_open_time = 5;
 bel_prolong_time = 10;
 bel_wave_out_level = 0.1;
-bel_wave_in_level = 10;
-bel_blink_time = 5;
+bel_wave_in_level = 10.0;
+bel_blink_time = 10;
 
 devices: (
   {

+ 8 - 5
src/rtl_airband.cpp

@@ -224,7 +224,7 @@ void* belysning_control_thread(void*){
         if (active==true && prolong==true){
             if (tv.tv_sec+10 >= stop_time){
                 stop_time=tv.tv_sec+bel_prolong_time;
-                printf("Prolong\n");
+                printf("Prolong %u\n",bel_prolong_time);
                 prolong = false;
             }
         }
@@ -234,10 +234,12 @@ void* belysning_control_thread(void*){
             printf("Stop\n");
         }
         if (active)
-            if ((stop_time<tv.tv_sec+bel_blink_time) && tv.tv_sec % 2 && bel_blink_time )
+            if ((stop_time<tv.tv_sec+bel_blink_time) && tv.tv_sec % 2 && bel_blink_time ){
                 gpiod_line_set_value(gpio26line, 0);  
-            else
+                printf("BLINKTIME %u",bel_blink_time);
+            }else{
                 gpiod_line_set_value(gpio26line, 1);
+            }
         else
             gpiod_line_set_value(gpio26line, 0);  
     }
@@ -1003,11 +1005,12 @@ int main(int argc, char* argv[]) {
             bel_open_time=(int)(root["bel_open_time"]);
         if (root.exists("bel_blink_time"))
             bel_blink_time=(int)(root["bel_blink_time"]);
-        if (root.exists("bel_wave_out_levele"))
+        if (root.exists("bel_wave_out_level"))
             bel_wave_out_level=(float)(root["bel_wave_out_level"]);
         if (root.exists("bel_wave_in_level"))
             bel_wave_in_level=(float)(root["bel_wave_in_level"]);
-
+        if (root.exists("bel_prolong_time"))
+            bel_prolong_time=(int)(root["bel_prolong_time"]);
         Setting& devs = config.lookup("devices");
         device_count = devs.getLength();
         if (device_count < 1) {