去掉battery获取电量过多的打印,电池主界面更新延迟到5秒一次
authorSnickerSun <snickersun@163.com>
Fri, 15 Dec 2023 07:14:01 +0000 (15:14 +0800)
committerSnickerSun <snickersun@163.com>
Fri, 15 Dec 2023 07:14:01 +0000 (15:14 +0800)
code/sdk/application/battery/battery.c
code/sdk/application/battery/battery.h
code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp

index b380c89..0b5c016 100644 (file)
@@ -132,7 +132,7 @@ static bool adc_get_sample_result(float *voltage, uint8_t channel)
     for (uint32_t i = 0; i < sample_number; i++) {
         uint32_t irq_sts = osal_irq_lock();
         uint32_t sample_result = (uint32_t)uapi_adc_manual_sample(ADC_CHANNEL_NONE);
-        osal_printk("sample_result = %d.\r\n", sample_result);
+        // osal_printk("sample_result = %d.\r\n", sample_result);
         if (sample_result == 0) { sample_zero_count++; }
         stick += sample_result;
         osal_irq_restore(irq_sts);
@@ -186,16 +186,16 @@ bool battery_get_voltage_by_channel(float *voltage, uint8_t channel)
     uapi_adc_init(ADC_CLOCK_500KHZ);
     uint64_t time1, time2;
     uint32_t param_index = 0;
-    osal_printk("channel: %d\r\n", channel);
+    // osal_printk("channel: %d\r\n", channel);
     time1 = uapi_tcxo_get_us();
     if (!adc_get_voltage_by_channel(voltage, channel)) {
         osal_printk("adc get sample result failed.\r\n");
         return SUITE_TEST_FAILED;
     }
     time2 = uapi_tcxo_get_us();
-    osal_printk("tick: %d, Sample time: %d. \r\n", adc_get_sample_stick(),
-        (uint64_t)(time2 - time1));
-    osal_printk("voltage: %.4f.\r\n", voltage);
+    // osal_printk("tick: %d, Sample time: %d. \r\n", adc_get_sample_stick(),
+        // (uint64_t)(time2 - time1));
+    // osal_printk("voltage: %.4f.\r\n", voltage);
 
     return true;
 }
index c752c8d..927e436 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
 bool battery_get_voltage_by_channel(float *voltage, uint8_t channel);
 
 /**
- * return 电池百分比 1~100
+ * return 电池百分比 0~100
  *       参数指针返回 真实电压 voltage 
 */
 uint8_t battery_get_voltage(float *voltage);
index 6f2cd3f..be18944 100755 (executable)
@@ -564,7 +564,7 @@ bool MainClockView::InitView(void)
         return false;
     }
     progress1callback_ = new ProgressCallback(progress,batteryLabel);
-    progress1animator_ = new Animator(progress1callback_,progress,100,true);
+    progress1animator_ = new Animator(progress1callback_,progress,5000,true);
     progress1animator_->Start();
     clockAnimator->Start();
     SetCoverable(true);