Commit 99be275a authored by 957dd's avatar 957dd

update recam

parent 81d821ab
controlcar00028
\ No newline at end of file
......@@ -20,6 +20,8 @@ extern int gPwmCount; // 计数
extern int gmessage_type;
extern int gmessage_4_index;
int mqtt_init();
void mqtt_create(struct mosquitto *mosq);
void on_connect(struct mosquitto *mosq, void *obj, int rc);
......
[3051:3051:0226/161158.659358:ERROR:page_load_metrics_update_dispatcher.cc(174)] Invalid first_paint (unset) for first_image_paint 1.351 s
[3051:3051:0226/161229.971216:ERROR:page_load_metrics_update_dispatcher.cc(174)] Invalid first_paint (unset) for first_image_paint 1.351 s
[3051:3051:0226/161259.038564:ERROR:page_load_metrics_update_dispatcher.cc(174)] Invalid first_paint (unset) for first_image_paint 1.351 s
No preview for this file type
File mode changed from 100644 to 100755
......@@ -33,6 +33,9 @@ unsigned char gvalt[4];//存放mqtt接收的tpye,mode等
struct mosquitto *mosq;
time_t gStart;
int gmessage_4_index=0;
char *glat=NULL;//加入gps后删除,心跳预留,不更改
char *glon=NULL;//加入gps后删除,心跳预留,不更改
......@@ -92,11 +95,6 @@ void mqtt_wirte()//心跳格式
void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
{
if (!cJSON_IsObject(pwm_ctrl))
{
return;
}
cJSON *mode = cJSON_GetObjectItem(pwm_ctrl, "mode"); //mode=1 速度,mode=2 转向(unsigned char)
cJSON *type = cJSON_GetObjectItem(pwm_ctrl, "type");
cJSON *val = cJSON_GetObjectItem(pwm_ctrl, "val"); //val为pwm的值 0~100(unsigned char)(unsigned char)
......@@ -120,10 +118,8 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
void message_4(cJSON *body, cJSON *pin_setctrl)//message 为4时候
{
if (!cJSON_IsObject(pin_setctrl))
{
return;
}
cJSON *pin = cJSON_GetObjectItem(pin_setctrl, "pin");
cJSON *val = cJSON_GetObjectItem(pin_setctrl, "val"); //val为pwm的值 0~100(unsigned char)(unsigned char)
pinTemp=pin->valueint;
......@@ -211,6 +207,12 @@ void on_message(struct mosquitto *mosq, void *obj, const struct mosquitto_messag
switch(gmessage_type)
{
case 2:
if(gmessage_4_index<=150)
{
free(payload_str);
return ;
}
gmessage_4_index=0;
refresh_cam();
break;
case 3:
......
No preview for this file type
......@@ -36,6 +36,9 @@ int opencamsh()
void refresh_cam() {//刷新页面
setenv("XAUTHORITY", "/home/orangepi/.Xauthority", 1);//加入授权
const char *search_command = "xdotool search --class \"chromium-browser\"";//获取窗口id
FILE *fp = popen(search_command, "r");
......
No preview for this file type
......@@ -30,12 +30,18 @@ void *AppExit(void *arg)//出现意外自动停止
{
Delay_Ms(0,100);
gPwmCount++;
if(gPwmCount>5)
gmessage_4_index++;
if(gPwmCount>=5)
{
midde_pwm();
gPwmCount=6;
pin_all_default();
}
if(gmessage_4_index>=150)//计时15s,15s才能远程刷新一次
{
gmessage_4_index=160;
}
}
return NULL;
......@@ -44,11 +50,9 @@ void *AppExit(void *arg)//出现意外自动停止
void *Mqttbeat(void *arg)
{
printf("Mqttbeat start\n");
//Delay_Ms(15,0);
//refresh_cam();//刷新cam
Delay_Ms(15,0);
refresh_cam();//刷新cam
Delay_Ms(10,0);
refresh_cam();
Delay_Ms(5,0);
while(1)
{
......@@ -64,7 +68,7 @@ void *opensh(void *arg)
{
Delay_Ms(5,0);
printf("open cam\n");
opencamsh();//10s后打开火狐游览器并且进入网址
opencamsh();//10s后打开游览器并且进入网址
return NULL;
}
......@@ -122,7 +126,6 @@ int main(int argc, char *argv[]) {
pin_init();
pwm_speed(); //pwm初始化,车为停止
Delay_Ms(60,0);
Delay_Ms(10,0);
const char *readbuf=device_inspect();
......
No preview for this file type
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