Commit c063a013 authored by 957dd's avatar 957dd

add firefox refresh

parent 07e6627a
#!/bin/bash
pkill firefox
# 设置 DISPLAY 环境变量(确保 Firefox 能运行图形界面)--new-window
export DISPLAY=:0
sudo firefox "https://8.129.3.163/index" --ignore-certificate-errors
\ No newline at end of file
#!/bin/bash
#sudo wmctrl -c firefox
#sleep 2 pkill firefox
# 设置 DISPLAY 环境变量(确保 Firefox 能运行图形界面)--new-window--ignore-certificate-errors
export DISPLAY=:0
firefox "https://8.129.3.163/index" &
\ No newline at end of file
This diff is collapsed.
No preview for this file type
......@@ -5,12 +5,7 @@
#include "delay.h"
#include "opensh.h"
void *opensh(void *arg)
{
sleep(10);
opencamsh();
return NULL;
}
void *serial_usart1(void *arg)
{
......@@ -24,14 +19,16 @@ void *serial_usart1(void *arg)
void *AppExit(void *arg)
{
while(1)
{
unsigned char bufpwm1[3]={gtypeTemp,1,0};
unsigned char bufpwm2[3]={gtypeTemp,2,0};
unsigned char bufpwm3[3]={gtypeTemp,3,0};
unsigned char bufpwm4[3]={gtypeTemp,4,0};
unsigned char bufpwm4[3]={gtypeTemp,4,0};\
if(gtypeTemp==3)
{
gPwmCount=0;
}
Delay_Ms(0,100);
gPwmCount++;
//printf( "%d\n",gtypeTemp);
......@@ -57,13 +54,21 @@ void *Mqttbeat(void *arg)
while(1)
{
mqtt_wirte();
Delay_Ms(3,200);
Delay_Ms(3,0);
}
return NULL;
}
void *opensh(void *arg)
{
Delay_Ms(10,0);
printf("open cam\n");
opencamsh();
return NULL;
}
void *serial_usart2(void *arg)
{
......@@ -88,7 +93,6 @@ int main(int argc, char *argv[]) {
ipaddr();//获取ip
mqtt_wirte();//mqtt心跳首次发送
//opencamsh();
thread_start(serial_usart1,AppExit,Mqttbeat,serial_usart2,opensh);
mqtt_cycle(mosq);
......
#include "mqtt.h"
#include "gps.h"
#include "opensh.h"
time_t gStart;
......@@ -35,7 +36,7 @@ int mqtt_init()
{
// 初始化 mosquitto 库
mosquitto_lib_init();
mosq = mosquitto_new(CLIENT_ID, true, NULL);
mosq = mosquitto_new(NULL, true, NULL);
if (!mosq) {
fprintf(stderr, "Failed to create Mosquitto client\n");
return -1;
......@@ -131,6 +132,7 @@ void message_0()//message_type为0时候要改变的值
}
void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
{
//pwm控制
......@@ -147,6 +149,10 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
gmodeTemp= mode->valueint;
gtypeTemp=type->valueint;
gvalTemp= val->valueint*3/4;
if(gtypeTemp==3)
{
gvalTemp= val->valueint;
}
gvalt[0]=gtypeTemp;
gvalt[1]=gmodeTemp;
gvalt[2]=gvalTemp;
......@@ -243,6 +249,9 @@ void on_message(struct mosquitto *mosq, void *obj, const struct mosquitto_messag
case 0:
message_0();
break;
case 2:
refresh_cam();
break;
case 3:
message_3(body,pwm_ctrl);
break;
......
......@@ -8,12 +8,12 @@
#include "ip.h"
#include "serial.h"
#define CLIENT_ID "carorship123"
#define BROKER_ADDRESS "119.45.167.177"
#define BROKER_PORT 1883
#define CLIENT_ID "feichirensheng/carorship"
#define TOPIC "controlcar0001"
#define TOPIC "controcar0004"
#define USERNAME "admin" // 替换为你的用户名
#define PASSWORD "admin" // 替换为你的密码
......
......@@ -9,6 +9,13 @@ int opencamsh()
{
return -1;
}
printf("open cam\n");
printf("close cam\n");
}
void refresh_cam()
{
system(SHELLFILECLOSE);
printf("recam\n");
}
......@@ -2,7 +2,10 @@
#define __opensh_H__
#define SHELLFILE "/home/kickpi/car/master/cam.sh"
#define SHELLFILE "/home/kickpi/car/master/camopen.sh"
#define SHELLFILECLOSE "/home/kickpi/car/master/recam.sh"
int opencamsh();
void refresh_cam();
#endif
\ No newline at end of file
#!/bin/bash
irefox_windows=$(xdotool search --name "Call 1V1 — Mozilla Firefox")
# 判断是否找到 Firefox 窗口
#if [ -z "$firefox_windows" ]; then
#echo "没有找到任何 Firefox 窗口。"
#exit 1
#fi
# 刷新所有找到的 Firefox 窗口 #echo "刷新窗口 ID: $window"
for window in $irefox_windows; do
xdotool windowactivate $window key Ctrl+r
done
\ No newline at end of file
......@@ -75,7 +75,7 @@ void serial_Receive_2()
void serial_Receive_1()
{
unsigned char buffer[3];
unsigned char buffer[256];
while(1)
{
......
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