Browse Source

开机自启动程序增加延时

corvin rasp melodic 2 years ago
parent
commit
0a630bdbf7

+ 0 - 0
src/dual_iic/oled_self_startup.service → src/dual_iic/oled_startup.service


+ 3 - 0
src/dual_iic/oled_startup.sh

@@ -0,0 +1,3 @@
+#! /bin/bash
+sleep 5
+sudo systemctl start oled_startup.service

+ 10 - 0
src/dual_iic/oled_startup_sh.service

@@ -0,0 +1,10 @@
+[Unit]
+Description=just for oled_startup_sh
+
+[Service]
+Type=simple
+ExecStart=/home/corvin/ros_minibot_ws/src/dual_iic/oled_startup.sh
+Restart=1
+
+[Install]
+WantedBy=multi-user.target

+ 2 - 3
src/dual_iic/src/driver.cpp

@@ -265,9 +265,8 @@ void Driver::GUI_Show(std::string bat)
     GUI_DisString_EN(0, 20, char_ip, &Font12, FONT_BACKGROUND, WHITE); 
 	GUI_DisString_EN(20, 20, buffer, &Font12, FONT_BACKGROUND, WHITE);
     GUI_DisString_EN(0, 40, char_bat, &Font12, FONT_BACKGROUND, WHITE);  
-    GUI_DisString_EN(28, 40, bat.c_str(), &Font12, FONT_BACKGROUND, WHITE);
-    OLED_Display();
-    usleep(2000);	
+    GUI_DisString_EN(26, 40, bat.c_str(), &Font12, FONT_BACKGROUND, WHITE);
+    OLED_Display();	
 }
 
 

+ 0 - 1
src/dual_iic/src/main.cpp

@@ -26,7 +26,6 @@ int main()
 	oled_driver.OLED_Init(OLED_ScanDir);
 
     printf("OLED Show \r\n");
-
     while(1)
 	{
         // int battery = battery_dev.I2C_Read_Battery();

+ 3 - 1
update_code.sh

@@ -26,8 +26,10 @@ echo -e "${green}>>> 2: 开始编译代码${normal}"
 catkin_make
 
 cd src/dual_iic/build
+rm -r *
+cmake ..
 make
-cd ../..
+cd ../../..
 
 if [ $? -eq 0 ];then
     echo -e "${green}编译代码完成,现在可以启动代码...${normal}"