2

Dependencies:   RemoteIR TextLCD

Revision:
66:2e2091dc7932
Parent:
65:7657ef347d6d
Child:
67:0333997269dc
--- a/main.cpp	Tue Sep 08 03:31:27 2020 +0000
+++ b/main.cpp	Tue Sep 08 05:31:18 2020 +0000
@@ -4,7 +4,7 @@
  */
  
  /*
- Version    0.08
+ Version    0.09
  Date       2020/09/08
  Uploader   Taku Nishimura
  
@@ -870,10 +870,32 @@
     }
     
     if(b <= 0){                      // バッテリー残量0%なら全ての機能停止
-        //b = 0;
-        lcd.setBacklight(TextLCD::LightOff);
+        if(flag_t == 1){
+            bTimer.stop();
+        }
+        lcd.cls();
+        if(trace_thread->get_state() != Thread::Deleted){
+            trace_thread->terminate();
+        }
+        if(avoi_thread->get_state() != Thread::Deleted){
+            avoi_thread->terminate();
+        }
+        if(wifi_thread->get_state() != Thread::Deleted){
+            wifi_thread->terminate();
+        }
+        if(deco_thread != NULL){
+            deco_thread->terminate();
+        }
         run = STOP;
-        exit(1);                   // 電池残量が5%未満の時、LCDを消灯し、モーターを停止し、プログラムを終了する。
+        ThisThread::sleep_for(10);
+        if(motor_thread != NULL){
+            motor_thread -> terminate(); 
+        } 
+        led1 = 0;
+        led2 = 0;
+        led3 = 0;
+        led4 = 0;      
+        exit(0);                   // 電池残量が5%未満の時、LCDを消灯し、モーターを停止し、プログラムを終了する。
     }
     mutex.lock();                    // ミューテックスロック
     lcd.setAddress(0,0);