Commit 6d565a90 authored by 学习的菜鸟's avatar 学习的菜鸟

加入mqtt切网络需要测试

parent 6d5a6a99
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
#define PROJECT_VERSION_MINOR 1 #define PROJECT_VERSION_MINOR 1
#define PROJECT_VERSION_PATCH 7 #define PROJECT_VERSION_PATCH 7
#define GIT_HASH "" #define GIT_HASH ""
#define BUILD_TIMESTAMP "2025-06-05T10:05:06" #define BUILD_TIMESTAMP "2025-06-06T09:12:32"
#define BUILD_USER "orangepi" #define BUILD_USER "orangepi"
No preview for this file type
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
#define CMD_BUFFER_SIZE 256 #define CMD_BUFFER_SIZE 256
#define MAX_WIFI_LIST 100 #define MAX_WIFI_LIST 100
#define default_SSID jking #define default_SSID "jking"
#define default_password 12345678 #define default_password "12345678"
#define WIFI_CONF_PATH "/home/orangepi/car/master/device_wifi.conf" #define WIFI_CONF_PATH "/home/orangepi/car/master/device_wifi.conf"
#define WIFI_CONF_DIR "/home/orangepi/car/master"
typedef struct { typedef struct {
char ssid[SSID_MAX_LEN]; char ssid[SSID_MAX_LEN];
...@@ -17,6 +18,7 @@ typedef struct { ...@@ -17,6 +18,7 @@ typedef struct {
} wifi_info_t; } wifi_info_t;
void scan_wifi_json();//显示以连接WiFi名称和周围已有的WiFi和过滤信号强度低于50的WiFi void scan_wifi_json();//显示以连接WiFi名称和周围已有的WiFi和过滤信号强度低于50的WiFi
int wifi_change_sendmqtt_init();//wifi改变初始化,放在main开头,必须要等mqtt直播就绪才行
void wifi_change_recmqtt(cJSON *body);//接收到修改WiFi指令
int delete_wifi_by_ssid(const char* ssid);//忘记指定的WiFi的密码
#endif #endif
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "judg.h" #include "judg.h"
#include "ads1115.h" #include "ads1115.h"
#include "audioplay.h" #include "audioplay.h"
#include "wifichange.h"
struct mosquitto *mosq; struct mosquitto *mosq;
...@@ -299,8 +300,11 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息 ...@@ -299,8 +300,11 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
my_zlog_debug("进入查询WiFi"); my_zlog_debug("进入查询WiFi");
break; break;
case 2004: case 2004:
wifi_change_recmqtt(body);
my_zlog_debug("进入修改WiFi");
break; break;
case 2005:download_message(body); case 2005:
download_message(body);
break; break;
default: default:
break; break;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "common.h" #include "common.h"
#include "device_exit.h" #include "device_exit.h"
#include "thread_main.h" #include "thread_main.h"
#include "wifichange.h"
pthread_t thread[6]; // 全局线程句柄数组(或传参) pthread_t thread[6]; // 全局线程句柄数组(或传参)
...@@ -60,7 +61,8 @@ void *AppExit(void *arg) { //出现意外自动停止 ...@@ -60,7 +61,8 @@ void *AppExit(void *arg) { //出现意外自动停止
void *Mqttbeat(void *arg) { void *Mqttbeat(void *arg) {
//printf("Mqttbeat start\n"); //printf("Mqttbeat start\n");
my_zlog_info("Mqttbeat start"); my_zlog_info("Mqttbeat start");
Delay_Ms(15,0); Delay_Ms(5,0);
wifi_change_sendmqtt_init();
while(1) { while(1) {
if( AppExit_pin_pwm == 202) Delay_Ms(0,45); if( AppExit_pin_pwm == 202) Delay_Ms(0,45);
if( AppExit_pin_pwm != 202) Delay_Ms(0,100); if( AppExit_pin_pwm != 202) Delay_Ms(0,100);
......
This diff is collapsed.
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