From: dxy15521469561 <1731678236@qq.com> Date: Tue, 12 Dec 2023 09:19:41 +0000 (+0800) Subject: D10: X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=4fbad835bebf920032ee75f77fb93961213560a8;p=mirrors%2FASR1603_G5.git D10: 自动开关机无铃声优化 --- diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py index c95dd7b7..5efab458 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -665,6 +665,7 @@ class intervManager(Abstract): return self.aud.stopPlayStream() + self.timer.stop() self.sos_timer2.stop() self.sos_timer1.stop() @@ -1156,7 +1157,7 @@ class intervManager(Abstract): date_tmp = utime.localtime() time_tmp = utime.mktime(date_tmp) EventMesh.publish("set_storage_config",["old_time",time_tmp])#关机保存一个是时间 - + EventMesh.publish("set_storage_config",["power_state",0]) self.pwk_timer1.start(3000,0,self.power_off_audio_cb) elif msg == 3: flag = EventMesh.publish("get_call_state") @@ -1198,7 +1199,7 @@ class intervManager(Abstract): date_tmp = utime.localtime() time_tmp = utime.mktime(date_tmp) EventMesh.publish("set_storage_config",["old_time",time_tmp])#关机保存一个是时间 - + EventMesh.publish("set_storage_config",["power_state",1]) self.pwk_timer1.start(3000,0,self.power_off_no_audio_cb)#不需要关机铃声 def fun(self,*argc): @@ -1214,7 +1215,12 @@ class intervManager(Abstract): def power_on_audio_cb(self, msg): self.power_on_flag = 1 # EventMesh.debug_log("power_on_audio_cb") - self.aud.play(1,0,'U:/static/R_POWER_OFF_1.mp3') + power_state = EventMesh.publish("get_storage_config","power_state") + if power_state == None: + power_state = 0 + print("power_state",power_state) + if power_state <= 0: + self.aud.play(1,1,'U:/static/R_POWER_OFF_1.mp3') # str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1")) # EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) EventMesh.publish("set_led_time_arg",[1,2,6*8,led_mode.FLASH_LIGHT_GREEN,6,3,led_mode.OTHER_MEASURE_MODE])#測量成功 @@ -1818,6 +1824,9 @@ class intervManager(Abstract): if flag == 0 and self.fall_flag == 0:#电话通话中 或者呼叫中挂断中断 if self.press_btn == 0: self.press_btn = 1 + audio_state = EventMesh.publish("get_audio_state") + if audio_state == 1: + self.aud.stop() EventMesh.publish("close_timer_all")# EventMesh.publish("set_led_time_arg",[1,1,160,led_mode.LONG_LIGHT_GREEN,4,2,led_mode.WECHAT_LED_MODE])#測量成功 # EventMesh.publish("set_led_time_arg",[1000,1000,1,led_mode.LONG_LIGHT_GREEN,led_mode.OPEN_LONG_LIGHT_MODE,led_mode.WECHAT_LED_MODE])#測量成功 diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py index ec4ff77a..2145807d 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py @@ -1125,66 +1125,72 @@ class DeviceInfoManager(Abstract): """"隔天清步数""" - hour = 0 - min = 0 - hour = date_tmp[3] - min = date_tmp[4] + + data = RTC().datetime() + + hour = data[4] + min = data[5] + + cur_month = int(data[1]) + cur_day = int(data[2]) + cur_year = int(data[0]) + old_Timesec = EventMesh.publish("get_old_time_data") + next_alarm_time = utime.localtime(int(old_Timesec)) old_step_state = EventMesh.publish("get_old_step_data") + # EventMesh.debug_log("hour:{} {} cur_month:{} {} next_alarm_time:{} old_Timesec:{}".format(hour,min,cur_month,cur_day,next_alarm_time,old_Timesec)) if old_step_state == None: old_step_state = 0 # EventMesh.debug_log("old_Timesec",old_Timesec) if old_Timesec != None and old_step_state != None: - data = RTC().datetime() - hour = data[4] - min = data[5] - next_alarm_time = utime.localtime(int(old_Timesec)) - # EventMesh.debug_log("data[5]:{} {} next_alarm_time:{} old_Timesec:{}".format(data[1],data[2],next_alarm_time,old_Timesec)) - month = next_alarm_time[1] + month = next_alarm_time[1] #00:00 day = next_alarm_time[2] - if month != data[1] or day != data[2]: - if old_step_state == 0: + year = next_alarm_time[0] + if month != cur_month or day != cur_day or year != cur_year:#å¹´ 月 日只要其中一个都不一样就清零 + step = EventMesh.publish("get_old_step_value") + EventMesh.publish("set_old_time_data",time_tmp) + self.gsensor.reset_step() + EventMesh.publish("set_old_step_value",0) + + hr = EventMesh.publish("get_old_hr_data") + if hr != 0: + EventMesh.publish("set_old_hr_data", 0) + + spo2 = EventMesh.publish("get_old_spo2_data") + if spo2 != 0: + EventMesh.publish("set_old_spo2_data", 0) + EventMesh.publish("set_old_step_data",[1,time_tmp]) + EventMesh.debug_log("clear step1111") + else: + EventMesh.publish("set_old_step_data",[4,time_tmp]) + + + if hour == 23:#清步数23:59 + if min <= 59 and min >= 58:#58 59 + clear_step_state = EventMesh.publish("get_old_step_data") + if clear_step_state == None: + clear_step_state = 0 + if self.clear_step == 0: + self.clear_step = 1 step = EventMesh.publish("get_old_step_value") - if step > 0: - self.gsensor.reset_step() - EventMesh.publish("set_old_step_value",0) - - hr = EventMesh.publish("get_old_hr_data",) + EventMesh.publish("set_old_time_data",time_tmp) + self.gsensor.reset_step() + EventMesh.publish("set_old_step_value",0) + + hr = EventMesh.publish("get_old_hr_data") if hr != 0: EventMesh.publish("set_old_hr_data", 0) spo2 = EventMesh.publish("get_old_spo2_data") if spo2 != 0: EventMesh.publish("set_old_spo2_data", 0) - EventMesh.publish("set_old_time_data",time_tmp) - EventMesh.publish("set_old_step_data",1)#清一次 - if hour == 23:#清步数 - if min <= 59 and min >= 58:#58 59 - clear_step_state = EventMesh.publish("get_old_step_data") - if clear_step_state == None: - clear_step_state = 0 - if self.clear_step == 0 : - if clear_step_state == 0: - step = EventMesh.publish("get_old_step_value") - EventMesh.publish("set_old_time_data",time_tmp) - EventMesh.publish("set_old_step_data",1) - if step > 0: - EventMesh.publish("set_old_step_value",0) - self.gsensor.reset_step() - hr = EventMesh.publish("get_old_hr_data") - if hr != 0: - EventMesh.publish("set_old_hr_data", 0) - - spo2 = EventMesh.publish("get_old_spo2_data") - if spo2 != 0: - EventMesh.publish("set_old_spo2_data", 0) - self.clear_step = 1 + EventMesh.publish("set_old_step_data",[2,time_tmp]) + EventMesh.debug_log("clear step2222") else: - if self.clear_step == 1: - self.clear_step = 0 - else: - if self.clear_step == 1: + EventMesh.publish("set_old_step_data",[3,time_tmp]) self.clear_step = 0 + else: + self.clear_step = 0 """电量小于20% 5分钟提醒一次""" get_low_btn = EventMesh.publish("get_low_bat_btn")# @@ -3549,12 +3555,16 @@ class getOldTimeManager(Abstract): def __init__(self): self.time_sec = 0 self.time_step = 0 + self.step_second = 0 tmp_data = EventMesh.publish("get_storage_config","old_time") if tmp_data !=None : self.time_sec = tmp_data - tmp_data = EventMesh.publish("get_storage_config","old_step") + tmp_data = EventMesh.publish("get_storage_config","clear_state") if tmp_data !=None : - self.time_step = tmp_data + self.time_step = tmp_data[0] + self.step_second = tmp_data[1] + + def post_processor_after_instantiation(self): EventMesh.subscribe("get_old_time_data", self.get_old_time_data) @@ -3566,18 +3576,19 @@ class getOldTimeManager(Abstract): def get_old_time_data(self, event, msg): return self.time_sec - def get_old_step_data(self, event, msg): - return self.time_step + def set_old_time_data(self, event, msg): self.time_sec = msg EventMesh.publish("set_storage_config",["old_time",msg]) def set_old_step_data(self, event, msg): - self.time_sec = msg - EventMesh.publish("set_storage_config",["old_step",msg]) + self.time_step = msg[0] + self.step_second = msg[1] + EventMesh.publish("set_storage_config",["clear_state",msg]) - + def get_old_step_data(self, event, msg): + return [self.time_step,self.step_second] diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py index b854cc70..4b36dd9a 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py @@ -282,7 +282,7 @@ class SockManager(Abstract): data = data + r EventMesh.debug_log("TCP recv: data:len:{}".format(len(data))) - EventMesh.debug_log("TCP recv: data:{}".format(data)) + # EventMesh.debug_log("TCP recv: data:{}".format(data)) if data[-1] != 0x5d and len(data)<20*1024: #']': continue self.connect_tmp = 1 #有数据,就认为是连接状态 diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py index 168e8c90..d40ded7e 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py @@ -824,9 +824,9 @@ class DeviceInfoManager(Abstract): day = next_alarm_time[2] if month != data[1] or day != data[2]: step = EventMesh.publish("get_old_step_value") - if step > 0: - self.gsensor.reset_step() - EventMesh.publish("set_old_step_value",0) + EventMesh.publish("set_old_time_data",time_tmp) + self.gsensor.reset_step() + EventMesh.publish("set_old_step_value",0) hr = EventMesh.publish("get_old_hr_data",) if hr != 0: @@ -835,16 +835,16 @@ class DeviceInfoManager(Abstract): spo2 = EventMesh.publish("get_old_spo2_data") if spo2 != 0: EventMesh.publish("set_old_spo2_data", 0) - EventMesh.publish("set_old_time_data",time_tmp) + - if hour == 0:#清步数 - if min <= 1: + if hour == 23:#清步数 + if min <= 59 and min >= 58: if self.clear_step == 0: + self.clear_step = 1 step = EventMesh.publish("get_old_step_value") EventMesh.publish("set_old_time_data",time_tmp) - if step > 0: - EventMesh.publish("set_old_step_value",0) - self.gsensor.reset_step() + EventMesh.publish("set_old_step_value",0) + self.gsensor.reset_step() hr = EventMesh.publish("get_old_hr_data") if hr != 0: EventMesh.publish("set_old_hr_data", 0) @@ -852,13 +852,11 @@ class DeviceInfoManager(Abstract): spo2 = EventMesh.publish("get_old_spo2_data") if spo2 != 0: EventMesh.publish("set_old_spo2_data", 0) - self.clear_step = 1 + else: - if self.clear_step == 1: - self.clear_step = 0 - else: - if self.clear_step == 1: self.clear_step = 0 + else: + self.clear_step = 0 """电量小于20% 5分钟提醒一次""" get_low_btn = EventMesh.publish("get_low_bat_btn")#