Commit 81d5f49c authored by 957dd's avatar 957dd

Merge branch 'feature/add_water_tank' into 'master'

Feature/add water tank See merge request !51
parents 2fdb2575 4557ff9f
...@@ -96,6 +96,7 @@ int hash_insert_init(HashTable_t *HashTable_t) { ...@@ -96,6 +96,7 @@ int hash_insert_init(HashTable_t *HashTable_t) {
insert(HashTable_t, "0201", TANK_0201); insert(HashTable_t, "0201", TANK_0201);
insert(HashTable_t, "0202", TANK_0202); insert(HashTable_t, "0202", TANK_0202);
insert(HashTable_t, "0203", TANK_0203); insert(HashTable_t, "0203", TANK_0203);
insert(HashTable_t, "0206", TANK_0206);
insert(HashTable_t, "0301", SHIP_0301); insert(HashTable_t, "0301", SHIP_0301);
insert(HashTable_t, "0401", PAO_0401); insert(HashTable_t, "0401", PAO_0401);
} }
...@@ -103,22 +104,25 @@ int hash_insert_init(HashTable_t *HashTable_t) { ...@@ -103,22 +104,25 @@ int hash_insert_init(HashTable_t *HashTable_t) {
int device_judg(CodeEnum_t code,char *sub_str) { int device_judg(CodeEnum_t code,char *sub_str) {
if (code == CAR_0101) { if (code == CAR_0101) {
device_init(DEVICE_CAR0101); device_init(DEVICE_CAR0101);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用大车,型号%s",sub_str);
}else if(code == CAR_0102) { }else if(code == CAR_0102) {
device_init(DEVICE_CAR0102); device_init(DEVICE_CAR0102);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用小车,型号%s",sub_str);
}else if(code == CAR_0103) { }else if(code == CAR_0103) {
device_init(DEVICE_CAR0103); device_init(DEVICE_CAR0103);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用挖掘机,型号%s",sub_str);
}else if(code == CAR_0104) { }else if(code == CAR_0104) {
device_init(DEVICE_CAR0104); device_init(DEVICE_CAR0104);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用推土机,使用型号%s",sub_str);
}else if(code == TANK_0202) { }else if(code == TANK_0202) {
device_init(DEVICE_TANK0202); device_init(DEVICE_TANK0202);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用型号%s",sub_str);
}else if(code == TANK_0203) { }else if(code == TANK_0203) {
device_init(DEVICE_TANK0203); device_init(DEVICE_TANK0203);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用M1A2坦克,型号%s",sub_str);
}else if(code == TANK_0206) {
device_init(DEVICE_TANK0206);
my_zlog_info("使用水坦克,型号%s",sub_str);
}else if(code ==PAO_0401) { }else if(code ==PAO_0401) {
device_init(DEVICE_PAO_PTZ0401); device_init(DEVICE_PAO_PTZ0401);
my_zlog_info("使用型号%s",sub_str); my_zlog_info("使用型号%s",sub_str);
......
...@@ -15,6 +15,7 @@ typedef enum { ...@@ -15,6 +15,7 @@ typedef enum {
TANK_0201, TANK_0201,
TANK_0202, TANK_0202,
TANK_0203, TANK_0203,
TANK_0206,
SHIP_0301, SHIP_0301,
PAO_0401 PAO_0401
} CodeEnum_t; } CodeEnum_t;
......
...@@ -82,11 +82,18 @@ void *thread_mqtt_beat(void *arg) { ...@@ -82,11 +82,18 @@ void *thread_mqtt_beat(void *arg) {
} }
void *thread_open_browser(void *arg) { void *thread_open_browser(void *arg) {
system("pkill chromium");
delay_s(3);
while(1){ while(1){
if(g_webrtc_index==1) { if(g_webrtc_index==1) {
if(is_browser_running() == true ) {
continue;
}else{
my_zlog_info("open cam"); my_zlog_info("open cam");
opencamsh();//10s后打开游览器并且进入网址 opencamsh();//10s后打开游览器并且进入网址
} }
}
delay_ms(200); delay_ms(200);
} }
......
...@@ -702,6 +702,30 @@ drivers/devicecontrol/tank0203_control.c.s: ...@@ -702,6 +702,30 @@ drivers/devicecontrol/tank0203_control.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0203_control.c.s $(MAKE) $(MAKESILENT) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0203_control.c.s
.PHONY : drivers/devicecontrol/tank0203_control.c.s .PHONY : drivers/devicecontrol/tank0203_control.c.s
drivers/devicecontrol/tank0206_control.o: drivers/devicecontrol/tank0206_control.c.o
.PHONY : drivers/devicecontrol/tank0206_control.o
# target to build an object file
drivers/devicecontrol/tank0206_control.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0206_control.c.o
.PHONY : drivers/devicecontrol/tank0206_control.c.o
drivers/devicecontrol/tank0206_control.i: drivers/devicecontrol/tank0206_control.c.i
.PHONY : drivers/devicecontrol/tank0206_control.i
# target to preprocess a source file
drivers/devicecontrol/tank0206_control.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0206_control.c.i
.PHONY : drivers/devicecontrol/tank0206_control.c.i
drivers/devicecontrol/tank0206_control.s: drivers/devicecontrol/tank0206_control.c.s
.PHONY : drivers/devicecontrol/tank0206_control.s
# target to generate assembly for a file
drivers/devicecontrol/tank0206_control.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0206_control.c.s
.PHONY : drivers/devicecontrol/tank0206_control.c.s
drivers/devicecontrol/tank_common.o: drivers/devicecontrol/tank_common.c.o drivers/devicecontrol/tank_common.o: drivers/devicecontrol/tank_common.c.o
.PHONY : drivers/devicecontrol/tank_common.o .PHONY : drivers/devicecontrol/tank_common.o
...@@ -1780,6 +1804,9 @@ help: ...@@ -1780,6 +1804,9 @@ help:
@echo "... drivers/devicecontrol/tank0203_control.o" @echo "... drivers/devicecontrol/tank0203_control.o"
@echo "... drivers/devicecontrol/tank0203_control.i" @echo "... drivers/devicecontrol/tank0203_control.i"
@echo "... drivers/devicecontrol/tank0203_control.s" @echo "... drivers/devicecontrol/tank0203_control.s"
@echo "... drivers/devicecontrol/tank0206_control.o"
@echo "... drivers/devicecontrol/tank0206_control.i"
@echo "... drivers/devicecontrol/tank0206_control.s"
@echo "... drivers/devicecontrol/tank_common.o" @echo "... drivers/devicecontrol/tank_common.o"
@echo "... drivers/devicecontrol/tank_common.i" @echo "... drivers/devicecontrol/tank_common.i"
@echo "... drivers/devicecontrol/tank_common.s" @echo "... drivers/devicecontrol/tank_common.s"
......
No preview for this file type
...@@ -3,8 +3,8 @@ CMAKE_PROGRESS_2 = ...@@ -3,8 +3,8 @@ CMAKE_PROGRESS_2 =
CMAKE_PROGRESS_3 = CMAKE_PROGRESS_3 =
CMAKE_PROGRESS_4 = 81 CMAKE_PROGRESS_4 = 81
CMAKE_PROGRESS_5 = CMAKE_PROGRESS_5 =
CMAKE_PROGRESS_6 = CMAKE_PROGRESS_6 = 82
CMAKE_PROGRESS_7 = 82 CMAKE_PROGRESS_7 =
CMAKE_PROGRESS_8 = CMAKE_PROGRESS_8 =
CMAKE_PROGRESS_9 = 83 CMAKE_PROGRESS_9 = 83
CMAKE_PROGRESS_10 = CMAKE_PROGRESS_10 =
......
CMAKE_PROGRESS_1 = CMAKE_PROGRESS_1 =
CMAKE_PROGRESS_2 = 90 CMAKE_PROGRESS_2 = 90
CMAKE_PROGRESS_3 = CMAKE_PROGRESS_3 =
CMAKE_PROGRESS_4 = CMAKE_PROGRESS_4 = 91
CMAKE_PROGRESS_5 = 91 CMAKE_PROGRESS_5 =
CMAKE_PROGRESS_6 = CMAKE_PROGRESS_6 =
CMAKE_PROGRESS_7 = 92 CMAKE_PROGRESS_7 = 92
...@@ -20,8 +20,8 @@ CMAKE_PROGRESS_19 = ...@@ -20,8 +20,8 @@ CMAKE_PROGRESS_19 =
CMAKE_PROGRESS_20 = CMAKE_PROGRESS_20 =
CMAKE_PROGRESS_21 = 8 CMAKE_PROGRESS_21 = 8
CMAKE_PROGRESS_22 = CMAKE_PROGRESS_22 =
CMAKE_PROGRESS_23 = 9 CMAKE_PROGRESS_23 =
CMAKE_PROGRESS_24 = CMAKE_PROGRESS_24 = 9
CMAKE_PROGRESS_25 = CMAKE_PROGRESS_25 =
CMAKE_PROGRESS_26 = 10 CMAKE_PROGRESS_26 = 10
CMAKE_PROGRESS_27 = CMAKE_PROGRESS_27 =
......
CMAKE_PROGRESS_1 = CMAKE_PROGRESS_1 =
CMAKE_PROGRESS_2 = 17 CMAKE_PROGRESS_2 = 17
CMAKE_PROGRESS_3 = CMAKE_PROGRESS_3 =
CMAKE_PROGRESS_4 = 18 CMAKE_PROGRESS_4 =
CMAKE_PROGRESS_5 = CMAKE_PROGRESS_5 = 18
CMAKE_PROGRESS_6 = CMAKE_PROGRESS_6 =
CMAKE_PROGRESS_7 = 19 CMAKE_PROGRESS_7 = 19
CMAKE_PROGRESS_8 = CMAKE_PROGRESS_8 =
...@@ -12,8 +12,8 @@ CMAKE_PROGRESS_11 = ...@@ -12,8 +12,8 @@ CMAKE_PROGRESS_11 =
CMAKE_PROGRESS_12 = CMAKE_PROGRESS_12 =
CMAKE_PROGRESS_13 = 21 CMAKE_PROGRESS_13 = 21
CMAKE_PROGRESS_14 = CMAKE_PROGRESS_14 =
CMAKE_PROGRESS_15 = 22 CMAKE_PROGRESS_15 =
CMAKE_PROGRESS_16 = CMAKE_PROGRESS_16 = 22
CMAKE_PROGRESS_17 = CMAKE_PROGRESS_17 =
CMAKE_PROGRESS_18 = 23 CMAKE_PROGRESS_18 = 23
CMAKE_PROGRESS_19 = CMAKE_PROGRESS_19 =
...@@ -26,8 +26,8 @@ CMAKE_PROGRESS_25 = ...@@ -26,8 +26,8 @@ CMAKE_PROGRESS_25 =
CMAKE_PROGRESS_26 = CMAKE_PROGRESS_26 =
CMAKE_PROGRESS_27 = 26 CMAKE_PROGRESS_27 = 26
CMAKE_PROGRESS_28 = CMAKE_PROGRESS_28 =
CMAKE_PROGRESS_29 = 27 CMAKE_PROGRESS_29 =
CMAKE_PROGRESS_30 = CMAKE_PROGRESS_30 = 27
CMAKE_PROGRESS_31 = CMAKE_PROGRESS_31 =
CMAKE_PROGRESS_32 = 28 CMAKE_PROGRESS_32 = 28
CMAKE_PROGRESS_33 = CMAKE_PROGRESS_33 =
...@@ -37,8 +37,8 @@ CMAKE_PROGRESS_36 = ...@@ -37,8 +37,8 @@ CMAKE_PROGRESS_36 =
CMAKE_PROGRESS_37 = CMAKE_PROGRESS_37 =
CMAKE_PROGRESS_38 = 30 CMAKE_PROGRESS_38 = 30
CMAKE_PROGRESS_39 = CMAKE_PROGRESS_39 =
CMAKE_PROGRESS_40 = 31 CMAKE_PROGRESS_40 =
CMAKE_PROGRESS_41 = CMAKE_PROGRESS_41 = 31
CMAKE_PROGRESS_42 = CMAKE_PROGRESS_42 =
CMAKE_PROGRESS_43 = 32 CMAKE_PROGRESS_43 = 32
CMAKE_PROGRESS_44 = CMAKE_PROGRESS_44 =
......
...@@ -3,11 +3,11 @@ CMAKE_PROGRESS_2 = ...@@ -3,11 +3,11 @@ CMAKE_PROGRESS_2 =
CMAKE_PROGRESS_3 = CMAKE_PROGRESS_3 =
CMAKE_PROGRESS_4 = 54 CMAKE_PROGRESS_4 = 54
CMAKE_PROGRESS_5 = CMAKE_PROGRESS_5 =
CMAKE_PROGRESS_6 = CMAKE_PROGRESS_6 = 55
CMAKE_PROGRESS_7 = 55 CMAKE_PROGRESS_7 =
CMAKE_PROGRESS_8 = CMAKE_PROGRESS_8 =
CMAKE_PROGRESS_9 = CMAKE_PROGRESS_9 = 56
CMAKE_PROGRESS_10 = 56 CMAKE_PROGRESS_10 =
CMAKE_PROGRESS_11 = CMAKE_PROGRESS_11 =
CMAKE_PROGRESS_12 = 57 CMAKE_PROGRESS_12 = 57
CMAKE_PROGRESS_13 = CMAKE_PROGRESS_13 =
...@@ -17,8 +17,8 @@ CMAKE_PROGRESS_16 = ...@@ -17,8 +17,8 @@ CMAKE_PROGRESS_16 =
CMAKE_PROGRESS_17 = CMAKE_PROGRESS_17 =
CMAKE_PROGRESS_18 = 59 CMAKE_PROGRESS_18 = 59
CMAKE_PROGRESS_19 = CMAKE_PROGRESS_19 =
CMAKE_PROGRESS_20 = CMAKE_PROGRESS_20 = 60
CMAKE_PROGRESS_21 = 60 CMAKE_PROGRESS_21 =
CMAKE_PROGRESS_22 = CMAKE_PROGRESS_22 =
CMAKE_PROGRESS_23 = 61 CMAKE_PROGRESS_23 = 61
CMAKE_PROGRESS_24 = CMAKE_PROGRESS_24 =
...@@ -28,11 +28,11 @@ CMAKE_PROGRESS_27 = ...@@ -28,11 +28,11 @@ CMAKE_PROGRESS_27 =
CMAKE_PROGRESS_28 = CMAKE_PROGRESS_28 =
CMAKE_PROGRESS_29 = 63 CMAKE_PROGRESS_29 = 63
CMAKE_PROGRESS_30 = CMAKE_PROGRESS_30 =
CMAKE_PROGRESS_31 = CMAKE_PROGRESS_31 = 64
CMAKE_PROGRESS_32 = 64 CMAKE_PROGRESS_32 =
CMAKE_PROGRESS_33 = CMAKE_PROGRESS_33 =
CMAKE_PROGRESS_34 = CMAKE_PROGRESS_34 = 65
CMAKE_PROGRESS_35 = 65 CMAKE_PROGRESS_35 =
CMAKE_PROGRESS_36 = CMAKE_PROGRESS_36 =
CMAKE_PROGRESS_37 = 66 CMAKE_PROGRESS_37 = 66
CMAKE_PROGRESS_38 = CMAKE_PROGRESS_38 =
...@@ -42,8 +42,8 @@ CMAKE_PROGRESS_41 = ...@@ -42,8 +42,8 @@ CMAKE_PROGRESS_41 =
CMAKE_PROGRESS_42 = CMAKE_PROGRESS_42 =
CMAKE_PROGRESS_43 = 68 CMAKE_PROGRESS_43 = 68
CMAKE_PROGRESS_44 = CMAKE_PROGRESS_44 =
CMAKE_PROGRESS_45 = CMAKE_PROGRESS_45 = 69
CMAKE_PROGRESS_46 = 69 CMAKE_PROGRESS_46 =
CMAKE_PROGRESS_47 = CMAKE_PROGRESS_47 =
CMAKE_PROGRESS_48 = 70 CMAKE_PROGRESS_48 = 70
CMAKE_PROGRESS_49 = CMAKE_PROGRESS_49 =
...@@ -53,8 +53,8 @@ CMAKE_PROGRESS_52 = ...@@ -53,8 +53,8 @@ CMAKE_PROGRESS_52 =
CMAKE_PROGRESS_53 = CMAKE_PROGRESS_53 =
CMAKE_PROGRESS_54 = 72 CMAKE_PROGRESS_54 = 72
CMAKE_PROGRESS_55 = CMAKE_PROGRESS_55 =
CMAKE_PROGRESS_56 = CMAKE_PROGRESS_56 = 73
CMAKE_PROGRESS_57 = 73 CMAKE_PROGRESS_57 =
CMAKE_PROGRESS_58 = CMAKE_PROGRESS_58 =
CMAKE_PROGRESS_59 = 74 CMAKE_PROGRESS_59 = 74
CMAKE_PROGRESS_60 = CMAKE_PROGRESS_60 =
...@@ -67,8 +67,8 @@ CMAKE_PROGRESS_66 = ...@@ -67,8 +67,8 @@ CMAKE_PROGRESS_66 =
CMAKE_PROGRESS_67 = CMAKE_PROGRESS_67 =
CMAKE_PROGRESS_68 = 77 CMAKE_PROGRESS_68 = 77
CMAKE_PROGRESS_69 = CMAKE_PROGRESS_69 =
CMAKE_PROGRESS_70 = CMAKE_PROGRESS_70 = 78
CMAKE_PROGRESS_71 = 78 CMAKE_PROGRESS_71 =
CMAKE_PROGRESS_72 = CMAKE_PROGRESS_72 =
CMAKE_PROGRESS_73 = 79 CMAKE_PROGRESS_73 = 79
CMAKE_PROGRESS_74 = CMAKE_PROGRESS_74 =
......
...@@ -173,13 +173,13 @@ void car0104_change(unsigned char *buf) { ...@@ -173,13 +173,13 @@ void car0104_change(unsigned char *buf) {
unsigned char val = buf[2]; unsigned char val = buf[2];
if(mode == 1 ) { if(mode == 1 ) {
car0104_flont(val); car0104_flont(val+25);
}else if(mode == 2 ) { }else if(mode == 2 ) {
car0104_back(val); car0104_back(val+25);
}else if(mode == 3) { }else if(mode == 3) {
car0104_lift(val+20); car0104_lift(90);
}else if(mode == 4) { }else if(mode == 4) {
car0104_right(val+20); car0104_right(90);
} }
} }
...@@ -28,6 +28,10 @@ const device_didrive device_didrive_control_config_t[]={ ...@@ -28,6 +28,10 @@ const device_didrive device_didrive_control_config_t[]={
.device_didrive_control = tank0203_change .device_didrive_control = tank0203_change
}, },
{ {
.device_id = DEVICE_TANK0206,
.device_didrive_control = tank0206_change
},
{
.device_id = DEVICE_PAO_PTZ0401, .device_id = DEVICE_PAO_PTZ0401,
.device_didrive_control = PTZ_pwm_change .device_didrive_control = PTZ_pwm_change
}, },
...@@ -81,6 +85,14 @@ const device_abnormal_close_t devcontrol_config_t[]= { ...@@ -81,6 +85,14 @@ const device_abnormal_close_t devcontrol_config_t[]= {
}, },
{ {
.device_id = DEVICE_TANK0206,
.device_abnormal_stop = tank0206_middle,
.device_close = tank_thread_close,
.gpio_pin_pulled=pin_all_default,
.gpio_pwm_pulled=pwm_all_default
},
{
.device_id = DEVICE_PAO_PTZ0401, .device_id = DEVICE_PAO_PTZ0401,
.device_abnormal_stop = PTZ_pwm_init, .device_abnormal_stop = PTZ_pwm_init,
.gpio_pin_pulled=pin_all_default, .gpio_pin_pulled=pin_all_default,
...@@ -102,7 +114,7 @@ void device_stop(int device_id) { ...@@ -102,7 +114,7 @@ void device_stop(int device_id) {
} }
if(!config) { if(!config) {
my_zlog_error("Error: Device stop ID %d not found!\n", device_id); my_zlog_error("Error: Device stop ID %d not found!", device_id);
return; return;
} }
...@@ -124,7 +136,7 @@ void device_end_close(int device_id) { ...@@ -124,7 +136,7 @@ void device_end_close(int device_id) {
} }
if(!config) { if(!config) {
my_zlog_error("Error: Device close ID %d not found!\n", device_id); my_zlog_error("Error: Device close ID %d not found!", device_id);
return; return;
} }
...@@ -145,7 +157,7 @@ void device_walk_control(int device_id,unsigned char *valt) { ...@@ -145,7 +157,7 @@ void device_walk_control(int device_id,unsigned char *valt) {
} }
if(!config) { if(!config) {
my_zlog_error("Error: Device close ID %d not found!\n", device_id); my_zlog_error("Error: Device close ID %d not found!", device_id);
return; return;
} }
......
...@@ -7,6 +7,4 @@ void tank0202_middle(); ...@@ -7,6 +7,4 @@ void tank0202_middle();
void tank0202_change(unsigned char *buf); void tank0202_change(unsigned char *buf);
/*销毁坦克使用的线程池,让其正常销毁,只有在tank0202设备号下才有用*/
void tank0202_thread_close();
#endif #endif
\ No newline at end of file
...@@ -7,6 +7,4 @@ void tank0203_middle(); ...@@ -7,6 +7,4 @@ void tank0203_middle();
void tank0203_change(unsigned char *buf); void tank0203_change(unsigned char *buf);
/*销毁坦克使用的线程池,让其正常销毁,只有在tank0202设备号下才有用*/
void tank0203_thread_close();
#endif #endif
\ No newline at end of file
#include "common.h"
#include "gpio_init.h"
#include "pthrpoll.h"
#include "tank0206_control.h"
void tank0206_middle() {
pwmWrite(PWM_PIN_SPEED,75);
pwmWrite(PWM_PIN_CHANGE,75);
}
void tank0206_mode_lift_flont(unsigned char gval) {
if (gval < 50) {
pwmWrite(PWM_PIN_SPEED, 75);
} else if (gval <= 55) {
pwmWrite(PWM_PIN_SPEED, 76);
} else if (gval <= 60) {
pwmWrite(PWM_PIN_SPEED, 77);
} else if (gval <= 65) {
pwmWrite(PWM_PIN_SPEED, 78);
} else if (gval <= 70) {
pwmWrite(PWM_PIN_SPEED, 79);
} else if (gval <= 75) {
pwmWrite(PWM_PIN_SPEED, 80);
} else if (gval <= 90) {
pwmWrite(PWM_PIN_SPEED, 81);
} else if (gval <= 100) {
pwmWrite(PWM_PIN_SPEED, 82);
} else if (gval <= 110) {
pwmWrite(PWM_PIN_SPEED, 83);
} else if (gval <= 120) {
pwmWrite(PWM_PIN_SPEED, 84);
} else if (gval <= 130) {
pwmWrite(PWM_PIN_SPEED, 85);
} else if (gval <= 140) {
pwmWrite(PWM_PIN_SPEED, 86);
} else if (gval <= 150) {
pwmWrite(PWM_PIN_SPEED, 87);
} else if (gval <= 160) {
pwmWrite(PWM_PIN_SPEED, 88);
} else if (gval <= 170) {
pwmWrite(PWM_PIN_SPEED, 89);
} else if (gval <= 180) {
pwmWrite(PWM_PIN_SPEED, 90);
} else if (gval <= 190) {
pwmWrite(PWM_PIN_SPEED, 91);
} else if (gval <= 200) {
pwmWrite(PWM_PIN_SPEED, 94);
}
}
void tank0206_mode_lift_back(unsigned char gval) {
if (gval < 50) {
pwmWrite(PWM_PIN_SPEED, 75);
} else if (gval <= 55) {
pwmWrite(PWM_PIN_SPEED, 74);
} else if (gval <= 60) {
pwmWrite(PWM_PIN_SPEED, 73);
} else if (gval <= 65) {
pwmWrite(PWM_PIN_SPEED, 72);
} else if (gval <= 70) {
pwmWrite(PWM_PIN_SPEED, 71);
} else if (gval <= 75) {
pwmWrite(PWM_PIN_SPEED, 70);
} else if (gval <= 90) {
pwmWrite(PWM_PIN_SPEED, 69);
} else if (gval <= 100) {
pwmWrite(PWM_PIN_SPEED, 68);
} else if (gval <= 110) {
pwmWrite(PWM_PIN_SPEED, 67);
} else if (gval <= 120) {
pwmWrite(PWM_PIN_SPEED, 66);
} else if (gval <= 130) {
pwmWrite(PWM_PIN_SPEED, 65);
} else if (gval <= 140) {
pwmWrite(PWM_PIN_SPEED, 64);
} else if (gval <= 150) {
pwmWrite(PWM_PIN_SPEED, 63);
} else if (gval <= 160) {
pwmWrite(PWM_PIN_SPEED, 62);
} else if (gval <= 170) {
pwmWrite(PWM_PIN_SPEED, 61);
} else if (gval <= 180) {
pwmWrite(PWM_PIN_SPEED, 60);
} else if (gval <= 190) {
pwmWrite(PWM_PIN_SPEED, 59);
} else if (gval <= 200) {
pwmWrite(PWM_PIN_SPEED, 56);
}
}
void tank0206_mode_right_flont(unsigned char gval) {
if (gval < 50) {
pwmWrite(PWM_PIN_CHANGE, 75);
} else if (gval <= 55) {
pwmWrite(PWM_PIN_CHANGE, 76);
} else if (gval <= 60) {
pwmWrite(PWM_PIN_CHANGE, 77);
} else if (gval <= 65) {
pwmWrite(PWM_PIN_CHANGE, 78);
} else if (gval <= 70) {
pwmWrite(PWM_PIN_CHANGE, 79);
} else if (gval <= 75) {
pwmWrite(PWM_PIN_CHANGE, 80);
} else if (gval <= 90) {
pwmWrite(PWM_PIN_CHANGE, 81);
} else if (gval <= 100) {
pwmWrite(PWM_PIN_CHANGE, 82);
} else if (gval <= 110) {
pwmWrite(PWM_PIN_CHANGE, 83);
} else if (gval <= 120) {
pwmWrite(PWM_PIN_CHANGE, 84);
} else if (gval <= 130) {
pwmWrite(PWM_PIN_CHANGE, 85);
} else if (gval <= 140) {
pwmWrite(PWM_PIN_CHANGE, 86);
} else if (gval <= 150) {
pwmWrite(PWM_PIN_CHANGE, 87);
} else if (gval <= 160) {
pwmWrite(PWM_PIN_CHANGE, 88);
} else if (gval <= 170) {
pwmWrite(PWM_PIN_CHANGE, 89);
} else if (gval <= 180) {
pwmWrite(PWM_PIN_CHANGE, 90);
} else if (gval <= 190) {
pwmWrite(PWM_PIN_CHANGE, 91);
} else if (gval <= 200) {
pwmWrite(PWM_PIN_CHANGE, 94);
}
}
void tank0206_mode_right_back(unsigned char gval) {
if (gval < 50) {
pwmWrite(PWM_PIN_CHANGE, 75);
} else if (gval <= 55) {
pwmWrite(PWM_PIN_CHANGE, 74);
} else if (gval <= 60) {
pwmWrite(PWM_PIN_CHANGE, 73);
} else if (gval <= 65) {
pwmWrite(PWM_PIN_CHANGE, 72);
} else if (gval <= 70) {
pwmWrite(PWM_PIN_CHANGE, 71);
} else if (gval <= 75) {
pwmWrite(PWM_PIN_CHANGE, 70);
} else if (gval <= 90) {
pwmWrite(PWM_PIN_CHANGE, 69);
} else if (gval <= 100) {
pwmWrite(PWM_PIN_CHANGE, 68);
} else if (gval <= 110) {
pwmWrite(PWM_PIN_CHANGE, 67);
} else if (gval <= 120) {
pwmWrite(PWM_PIN_CHANGE, 66);
} else if (gval <= 130) {
pwmWrite(PWM_PIN_CHANGE, 65);
} else if (gval <= 140) {
pwmWrite(PWM_PIN_CHANGE, 64);
} else if (gval <= 150) {
pwmWrite(PWM_PIN_CHANGE, 63);
} else if (gval <= 160) {
pwmWrite(PWM_PIN_CHANGE, 62);
} else if (gval <= 170) {
pwmWrite(PWM_PIN_CHANGE, 61);
} else if (gval <= 180) {
pwmWrite(PWM_PIN_CHANGE, 60);
} else if (gval <= 190) {
pwmWrite(PWM_PIN_CHANGE, 59);
} else if (gval <= 200) {
pwmWrite(PWM_PIN_CHANGE, 55);
}
}
void tank0206_change(unsigned char *buf) {
unsigned char mode = buf[1];
unsigned char val = buf[2];
static int modecount_tank0206=0;
if(mode == 1 ) {
//tank0203_mode_lift_flont(val);
tank0206_mode_right_flont(val);
modecount_tank0206=0;
}else if(mode == 2 ) {
//tank0203_mode_lift_back(val);
tank0206_mode_right_back(val);
modecount_tank0206=1;
}
if((mode == 1||mode ==2)&&val == 0) modecount_tank0206=0;
if(mode == 3) {
if(modecount_tank0206 == 0) tank0206_mode_lift_flont(val+10);
if(modecount_tank0206 == 1) tank0206_mode_lift_back(val+10);
}else if(mode == 4) {
if(modecount_tank0206 == 0) tank0206_mode_lift_back(val+10);
if(modecount_tank0206 == 1) tank0206_mode_lift_flont(val+10);
}
}
#ifndef TANK0206_CONTROL_H__
#define TANK0206_CONTROL_H__
void tank0206_middle();
void tank0206_change(unsigned char *buf);
#endif
\ No newline at end of file
...@@ -142,7 +142,7 @@ void tank_shot_stop_control(int device_id,unsigned char pin,unsigned char val) { ...@@ -142,7 +142,7 @@ void tank_shot_stop_control(int device_id,unsigned char pin,unsigned char val) {
} }
if(!g_tank_common_config_t) { if(!g_tank_common_config_t) {
my_zlog_error("Error: Device stop ID %d not found!\n", device_id); my_zlog_error("Error: Device stop ID %d not found!", device_id);
return; return;
} }
g_tank_common_config_t->shot_back(pin,val); g_tank_common_config_t->shot_back(pin,val);
......
...@@ -68,6 +68,15 @@ const deviceconfig_t device_configs[] = { ...@@ -68,6 +68,15 @@ const deviceconfig_t device_configs[] = {
.emergency_code = 203 .emergency_code = 203
}, },
{ {
.device_id = DEVICE_TANK0206,
.device_name = "tank0206",
.gpio_pins = {6, 16, 20, 22, 23,-1},/* 补充GPIO引脚 */
.gpio_pwms = {5 , 7 ,24,26, 27,-1},
.device_pwm_init = physics_pwm_init,
.device_control_stop = tank0206_middle,/* 补充速度控制函数 */
.emergency_code = 206
},
{
.device_id = DEVICE_PAO_PTZ0401, .device_id = DEVICE_PAO_PTZ0401,
.device_name = "ptz0401", .device_name = "ptz0401",
.gpio_pins = {5, 6, 7, 10, 16, 20, 22, 23, 24, 25, 26,-1},/* 补充GPIO引脚 */ .gpio_pins = {5, 6, 7, 10, 16, 20, 22, 23, 24, 25, 26,-1},/* 补充GPIO引脚 */
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#define MIN_DUTY 0 // 最小占空比 #define MIN_DUTY 0 // 最小占空比
#define MAX_DUTY 100 // 最大占空比 #define MAX_DUTY 100 // 最大占空比
// int device_delay_count =0;//设备计算函数
int g_gpioPwm[30];//软件控制 int g_gpioPwm[30];//软件控制
int g_gpiowpi[40]; //能使用高低引脚和其他引脚 int g_gpiowpi[40]; //能使用高低引脚和其他引脚
...@@ -69,6 +67,7 @@ void pwm_value(int pin,int value) { //软件陪我们控制调速 ...@@ -69,6 +67,7 @@ void pwm_value(int pin,int value) { //软件陪我们控制调速
if(pin == 27){ if(pin == 27){
if(g_device_type == DEVICE_TANK0202) softPwmWrite(pin, 50); if(g_device_type == DEVICE_TANK0202) softPwmWrite(pin, 50);
else if(g_device_type == DEVICE_TANK0203) softPwmWrite(pin, 50); else if(g_device_type == DEVICE_TANK0203) softPwmWrite(pin, 50);
else if(g_device_type == DEVICE_TANK0206) softPwmWrite(pin, 45);
else { else {
softPwmWrite(pin, shot_speed); softPwmWrite(pin, shot_speed);
my_zlog_debug("pin:%d,%d",pin,shot_speed); my_zlog_debug("pin:%d,%d",pin,shot_speed);
...@@ -76,6 +75,7 @@ void pwm_value(int pin,int value) { //软件陪我们控制调速 ...@@ -76,6 +75,7 @@ void pwm_value(int pin,int value) { //软件陪我们控制调速
} else { } else {
if(g_device_type == DEVICE_TANK0202) softPwmWrite(pin, 35); if(g_device_type == DEVICE_TANK0202) softPwmWrite(pin, 35);
if(g_device_type == DEVICE_TANK0203) softPwmWrite(pin, 35); if(g_device_type == DEVICE_TANK0203) softPwmWrite(pin, 35);
if(g_device_type == DEVICE_TANK0206) softPwmWrite(pin, 35);
else{ else{
softPwmWrite(pin, shot_speed); softPwmWrite(pin, shot_speed);
} }
...@@ -119,6 +119,3 @@ void physics_pwm_init() { ...@@ -119,6 +119,3 @@ void physics_pwm_init() {
} }
void device_exit_end(){//main最后结束需要调用的函数
//if(AppExit_pin_pwm == 202) tank_shot_back_stop_task_end();
}
\ No newline at end of file
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef GPIO_INIT_H__ #ifndef GPIO_INIT_H__
#define GPIO_INIT_H__ #define GPIO_INIT_H__
//extern int device_delay_count;//延时计算函数,使用前必须置0
// 定义 PWM 引脚的 WiringPi 编号 // 定义 PWM 引脚的 WiringPi 编号
#define PWM_PIN_SPEED 21 #define PWM_PIN_SPEED 21
#define PWM_PIN_CHANGE 2 #define PWM_PIN_CHANGE 2
...@@ -23,6 +21,5 @@ void pin_value(int pin,int value); ...@@ -23,6 +21,5 @@ void pin_value(int pin,int value);
void physics_pwm_init(); void physics_pwm_init();
void pwm_value(int pin,int value); //软件陪我们控制调速 void pwm_value(int pin,int value); //软件陪我们控制调速
void device_exit_end();//main最后结束需要调用的函数
#endif #endif
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
## 设备速冻后台设置 ## 设备速冻后台设置
- tank0202 最大为200,更据电池电压具体调速。原电池为7.6v,大概为140左右 - tank0202 最大为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
- tank0203 M1A2最大为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
- tank0204 M1A2最大为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
- tank0205 M1A2最大为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
- tank0202~0205为眯眼潮玩坦克。
- tank0206 为可以发射水枪的水坦克.原电池为3.3v,大概为80左右
- car0101 最大为150,尽量不能这么大 - car0101 最大为150,尽量不能这么大
- car0102 为小车 最大速度为200 - car0102 为小车 最大速度为200
- car0103 为挖机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右 - car0103 为挖机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ptz0401_control.h" #include "ptz0401_control.h"
#include "tank0202_control.h" #include "tank0202_control.h"
#include "tank0203_control.h" #include "tank0203_control.h"
#include "tank0206_control.h"
#include "tank_common.h" #include "tank_common.h"
#include "common.h" #include "common.h"
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
#define DEVICE_TANK0201 201 #define DEVICE_TANK0201 201
#define DEVICE_TANK0202 202 #define DEVICE_TANK0202 202
#define DEVICE_TANK0203 203 #define DEVICE_TANK0203 203
#define DEVICE_TANK0206 206
#define DEVICE_PAO_PTZ0401 401 #define DEVICE_PAO_PTZ0401 401
typedef struct { typedef struct {
......
...@@ -119,3 +119,13 @@ void refresh_cam() {//刷新页面 ...@@ -119,3 +119,13 @@ void refresh_cam() {//刷新页面
my_zlog_debug("刷新成功"); my_zlog_debug("刷新成功");
} }
// 检查Chromium进程是否已运行
bool is_browser_running() {
FILE *fp = popen("pgrep chromium", "r");
if (fp == NULL) return false;
char buf[16];
bool running = (fgets(buf, sizeof(buf), fp) != NULL);
pclose(fp);
return running;
}
\ No newline at end of file
...@@ -8,4 +8,6 @@ int opencamsh(); ...@@ -8,4 +8,6 @@ int opencamsh();
void refresh_cam();//刷新摄像头函数 void refresh_cam();//刷新摄像头函数
bool is_browser_running();
#endif #endif
\ No newline at end of file
...@@ -9,7 +9,7 @@ const char *c_post = "http://47.119.190.60/api/v1/device/config"; ...@@ -9,7 +9,7 @@ const char *c_post = "http://47.119.190.60/api/v1/device/config";
int g_errCodeValue; int g_errCodeValue;
bool g_enable_buzzer_value=0; bool g_enable_buzzer_value=false;
double g_warn_voltage_value=10.7; double g_warn_voltage_value=10.7;
double g_err_voltage_value=9.7; double g_err_voltage_value=9.7;
double g_shot_speed_value=0.5; double g_shot_speed_value=0.5;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment