定时开机问题
authorp15692025051 <846603105@qq.com>
Mon, 27 Nov 2023 07:51:13 +0000 (15:51 +0800)
committerp15692025051 <846603105@qq.com>
Mon, 27 Nov 2023 07:51:13 +0000 (15:51 +0800)
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py

index 7505f86..7ae51ac 100644 (file)
@@ -3326,8 +3326,8 @@ class getBootOffManager(Abstract):#开关机时间
         self.off_flag = 0
         self.rtc =  RTC()
         self.off_on = 1
-        self.off_start = "06:00"
-        self.off_end = "23:00"
+        self.off_start = "6:0"
+        self.off_end = "23:0"
         read_data = EventMesh.publish("get_storage_config","off_on")
         if read_data != None:
             self.off_on = read_data
@@ -3344,6 +3344,7 @@ class getBootOffManager(Abstract):#开关机时间
         EventMesh.subscribe("get_boot_off_time", self.get_boot_off_time)
 
     def set_boot_off_time(self, event, msg): 
+        print("set_boot_off_time",msg)
         EventMesh.publish("set_storage_config",["off_on",msg[0]])
         EventMesh.publish("set_storage_config",["off_start",msg[1]])
         EventMesh.publish("set_storage_config",["off_end",msg[2]])
@@ -3357,10 +3358,10 @@ class getBootOffManager(Abstract):#开关机时间
         if self.off_on == None:
             self.off_on = 1
         if self.off_start == None:
-            self.off_start = "06:00"
+            self.off_start = "6:0"
 
-        if self.off_on == None:
-            self.off_on = "23:00" 
+        if self.off_end == None:
+            self.off_end = "23:0" 
         return [self.off_on,self.off_start,self.off_end]
 class setSmsIndexManager(Abstract):#
     def __init__(self):
@@ -3473,8 +3474,7 @@ class ClockManager(Abstract):
         EventMesh.subscribe("push_update_alarm_show", self.update_show_info)
 
     def post_processor_after_instantiation(self):
-        
-
+    
         EventMesh.publish("read_alarminjson")
         EventMesh.publish("set_rtc_alarm")
        
@@ -3510,6 +3510,20 @@ class ClockManager(Abstract):
         if IFEXIST == True:
             with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
                 alarm_list = ujson.load(fd)
+
+        
+        # read_data = EventMesh.publish("get_storage_config","off_on")
+
+        hour1 = str(alarm_list[0]["hour"])+':'+str(alarm_list[0]["minute"])
+        # min1 = str(alarm_list[0]["minute"])
+
+        hour2 = str(alarm_list[1]["hour"])+':'+str(alarm_list[1]["minute"])
+        # min2 = str(alarm_list[1]["minute"]) 
+        EventMesh.publish("set_boot_off_time",[1,hour1,hour2])
+
+        print("hour1:{}-{}".format(hour1,hour2))
+
+        
         return alarm_list
 
     def add_alarm(self, event, msg):
@@ -3594,8 +3608,8 @@ class ClockManager(Abstract):
         msg_data = EventMesh.publish("get_boot_off_time")
         EventMesh.debug_log("msg_tmp:{}".format(msg_data))
         off_on = 1
-        off_start = "06:00"
-        off_end = "23:00"
+        off_start = "6:0"
+        off_end = "23:0"
         if msg_data[0] != None:
             off_on = int(msg_data[0])
         if msg_data[1] != None: