计算器修改,改为删除仅删除一位 #905 目标同步修改 #921 1137/2 1137/head
authorhcj <1224667075@qq.com>
Wed, 9 Oct 2024 11:24:39 +0000 (19:24 +0800)
committerhcj <1224667075@qq.com>
Wed, 9 Oct 2024 11:24:39 +0000 (19:24 +0800)
code/sdk/application/wearable/fd230app/nativeui/calculator/include/CalculatorModel.h
code/sdk/application/wearable/fd230app/nativeui/calculator/include/CalculatorView.h
code/sdk/application/wearable/fd230app/nativeui/calculator/src/CalculatorModel.cpp
code/sdk/application/wearable/fd230app/nativeui/calculator/src/CalculatorView.cpp
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c

index cbb79ae..9412c33 100644 (file)
@@ -31,6 +31,7 @@ public:
     uint8_t get_stcak_size();
     void  symbol_stack_top_uddata(char data);
     void clean_stack();
+    void symbol_stack_pop(void);
 private:
     CalculatorModel();
     CalculatorModel(const CalculatorModel &);
index 3d27578..cee7cd0 100644 (file)
@@ -66,7 +66,7 @@ private:
     UILabel *number{nullptr};
     UILabelExt *hint{nullptr};
 
-    std::string number_string="";
+    std::string number_string=" ";
 
     UIView::OnClickListener* clickLeftListener{nullptr};
     UIView:: OnDragListener* dragListener{nullptr};
index a161d49..cdcaed1 100644 (file)
@@ -59,6 +59,15 @@ void CalculatorModel:: symbol_stack_top_uddata(char data)
     }
 }
 
+
+void CalculatorModel:: symbol_stack_pop(void)
+{
+    if(!symbolStack.empty())
+    {
+        symbolStack.pop();
+    }
+}
+
 uint8_t CalculatorModel::get_stcak_size()
 {
     return numberStack.size();
index 24abc75..fb90e38 100644 (file)
@@ -285,7 +285,7 @@ void CalculatorView::symbol_text_updata_single_buf(const char *buf)
 
     char new_buf[64]={0};
 
-    const char*text_buf=number_string.c_str();
+    char*text_buf=(char *)number_string.c_str();
    
     double number_float=strtod(text_buf,NULL);
     if(buf[0]=='C')
@@ -345,12 +345,22 @@ void CalculatorView::symbol_text_updata_single_buf(const char *buf)
     }
     else if (buf[0]=='D')
     {
-        number_float=0;
-        sprintf_s(new_buf,16,"%.00lf",number_float);
-
-        number_string=new_buf;
-        number->SetText(new_buf);
-        number_falg=2;
+        // number_float=0;
+        // sprintf_s(new_buf,16,"%.00lf",number_float);
+        text_buf[number_string.length()-1]='\0';
+        number_string=text_buf;
+        number->SetText(text_buf);
+        if(number_falg==0)
+        {
+            CalculatorModel::GetInstance()->symbol_stack_pop();
+            number_falg=1;
+        }
+        else 
+        {
+            number_falg=1;
+        }
+        
+       
         RootView::GetInstance()->Invalidate();
     }
 
index 9f2681d..ae4f8b4 100644 (file)
@@ -2430,6 +2430,8 @@ void SetsteptargetParamCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *tota
 \r
         printf("设置步数:%d %d %d %d \r\n",targetStep,ringOn,vibration,notify);\r
 \r
+        set_goal_stepcount(targetStep);\r
+        \r
 \r
         if(ringOn &&vibration &&  notify)\r
         set_goal_step_notification(1);\r