This commit is contained in:
2026-01-26 11:17:15 +08:00
parent 419f6cc78c
commit 57957e69c7
8 changed files with 43 additions and 45 deletions

View File

@ -4,5 +4,5 @@
nvs, data, nvs, 0x9000, 0x4000,
otadata, data, ota, 0xd000, 0x2000,
phy_init, data, phy, 0xf000, 0x1000,
ota_0, app, ota_0, 0x10000, 0xF00000,
ota_1, app, ota_1, 0xF10000, 0xF00000,
ota_0, app, ota_0, 0x10000, 0x180000,
ota_1, app, ota_1, 0x190000, 0x180000,
1 # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
4 nvs, data, nvs, 0x9000, 0x4000,
5 otadata, data, ota, 0xd000, 0x2000,
6 phy_init, data, phy, 0xf000, 0x1000,
7 ota_0, app, ota_0, 0x10000, 0xF00000, ota_0, app, ota_0, 0x10000, 0x180000,
8 ota_1, app, ota_1, 0xF10000, 0xF00000, ota_1, app, ota_1, 0x190000, 0x180000,

View File

@ -51,3 +51,4 @@ board_build.filesystem = spiffs
monitor_filters = esp32_exception_decoder
monitor_speed = 115200

View File

@ -9,9 +9,12 @@ const uint32_t mqtt_port = 40000;
const char *mqtt_client_id = "gaoguangpu_001";
const char *mqtt_username = "remotecontroler";
const char *mqtt_password = "irishk";
const char *publish_topic = "gaoguangpu/return/IS11_id";
const char *subscribe_topic = "gaoguangpu/command/IS11_id";
// const char *publish_topic = "gaoguangpu/return/IS11_id";
// const char *subscribe_topic = "gaoguangpu/command/IS11_id";
// SpectraSenorV2/command
// SpectraSenorV2/return
String str_publish_topic ="SpectraSenorV2/command/";
String str_subscribe_topic = "SpectraSenorV2/return/";
EventGroupHandle_t http_event_group;
void callback(char* topic, byte* payload, unsigned int length) {
@ -34,6 +37,8 @@ void callback(char* topic, byte* payload, unsigned int length) {
}
void reconnect() {
const char *subscribe_topic = str_subscribe_topic.c_str();
// 重新连接MQTT
while (!mqtt_client->connected())
{
@ -88,8 +93,12 @@ void gsmm_mqtt_loop_task(void *pvParameters)
HttpClient *http;
UpDateClassByme ggp_UpDate(http);
void gsmm_mqtt_init()
// String str_publish_topic ="SpectraSenorV2/command/";
// String str_subscribe_topic = "SpectraSenorV2/return/";
void gsmm_mqtt_init(String sensor_id)
{
str_publish_topic = str_publish_topic + sensor_id;
str_subscribe_topic = str_subscribe_topic + sensor_id;
http_event_group = xEventGroupCreate();
// if(http_event_group == NULL)
// {
@ -103,14 +112,14 @@ void gsmm_mqtt_init()
// http = new HttpClient(*gsmmanger->client, "82.156.1.111");
http = new HttpClient(*gsmmanger->client, mqtt_server);
xTaskCreatePinnedToCore(gsmm_mqtt_loop_task, "gsmm_mqtt_loop_task",1024*3,NULL, 1, NULL, 1);
}
void mqtt_write(uint8_t *data , uint32_t lenth)
{
const char *publish_topic = str_publish_topic.c_str();
bool messageSent = false;
// String str_publish_topic =publish_topic + '/' + ;
do
{
messageSent = mqtt_client->publish(publish_topic,data,lenth);

View File

@ -26,7 +26,8 @@ typedef struct gps_struct{
float longitude;
}gps_struct;
void gsmm_mqtt_init();
// void gsmm_mqtt_init();
void gsmm_mqtt_init(String sensor_id);
void mqtt_write(uint8_t *data , uint32_t lenth);
bool UpdateData(String path,uint8_t *data, size_t lenth, String Contenttype);
void httpUpload(uint8_t *data,uint32_t lenth);

View File

@ -47,7 +47,7 @@ void log_init()
void write_log(String path,String write_data,unsigned char level)
{
if(level <150) {
if(level <5) {
// U0_Serial.println(write_data);
Serial0.println(write_data);
}

View File

@ -172,8 +172,8 @@ void setup()
// while (1)
// {
// Serial0.println("66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666");
// vTaskDelay(10);
// Serial0.println("66666666666666666666666");
// vTaskDelay(1000);
// }
log_init();
@ -250,8 +250,6 @@ void setup()
Serial0.println("IS_SN :" +STRSensorInfos_structure.serialnumber);
sys_info_init();
dingbiao_init("/dingbiao/dingbiao_up_gain.bin");
@ -281,7 +279,7 @@ void setup()
if(sys_sd_doc["status_4g"] == "open_4g")
{
gsmm_mqtt_init();
gsmm_mqtt_init(STRSensorInfos_structure.serialnumber);
xTaskCreatePinnedToCore(task_4G_mode, "task_4G_mode",1024*(20),NULL, 1,NULL, 1);
xTaskCreatePinnedToCore(OTA_task, "OTA_task",1024*(10),NULL, 1,NULL, 1);
@ -368,13 +366,11 @@ void Task0(void *pvParameters)
if (atuo_return == 1)
{
is11Sensor->senddata(&wb485Serial,return_data_type, fengbao_num);
}
vTaskDelay(1000 * time_interval);
break;
case 3:
is11Sensor->senddata(&wb485Serial,return_data_type, fengbao_num);
uint_work_task0 = 100;
break;
@ -836,7 +832,6 @@ void task_4G_mode(void *pvParameters)
doc_4G["SN"] = STRSensorInfos_structure.serialnumber;
if(check_tuigan() == false )
{
warn_sta = true;
doc_4G["tuigan"] = "warn";
if(get_tuigan_status() == tui)
@ -2319,6 +2314,7 @@ void json_command(uint8_t port_type)
if(port_type == 1) wb485Serial.write(send_buff,ret);
else if(port_type == 2) mqtt_write(send_buff,ret);
}
//command 31
//计算波长
else if(doc["command"] =="calculation")
@ -2368,11 +2364,12 @@ void json_command(uint8_t port_type)
if(port_type == 1) wb485Serial.write(send_buff,ret);
else if(port_type == 2) mqtt_write(send_buff,ret);
}
//command 34
else if(doc["command"] == "get_fanshelv_gain")
{
send_dingbiao("/dingbiao/fanshelv_gain.bin");
}
//command 35
else if(doc["command"] == "set_4g")
{
save = true;
@ -2384,6 +2381,7 @@ void json_command(uint8_t port_type)
if(port_type == 1) wb485Serial.write(send_buff,ret);
else if(port_type == 2) mqtt_write(send_buff,ret);
}
//command 36
else if(doc["command"] == "OTA")
{
sys_sd_doc["version_url"] = doc["version_url"];
@ -2396,6 +2394,7 @@ void json_command(uint8_t port_type)
else if(port_type == 2) mqtt_write(send_buff,ret);
xEventGroupSetBits(Main_EventGroup, OTA_BIT);
}
//command 37
else if(doc["command"] == "USB")
{
send_str = "";
@ -2407,6 +2406,7 @@ void json_command(uint8_t port_type)
// myusb_init();
setupmsc();
}
//command 38
else if(doc["command"] == "reboot")
{
// setupmsc();

View File

@ -78,13 +78,13 @@ static bool onStartStop(uint8_t power_condition, bool start, bool load_eject) {
// case ARDUINO_USB_STOPPED_EVENT: Serial.println("USB UNPLUGGED"); break;
// case ARDUINO_USB_SUSPEND_EVENT: Serial.printf("USB SUSPENDED: remote_wakeup_en: %u\n", data->suspend.remote_wakeup_en); break;
// case ARDUINO_USB_RESUME_EVENT: Serial.println("USB RESUMED"); break;
// default: break;
// }
// }
// }
void setupmsc() {
void setupmsc()
{
msc.vendorID("ESP32123");
msc.productID("USB_MSC123");
msc.productRevision("1.0");
@ -94,10 +94,8 @@ void setupmsc() {
msc.mediaPresent(true);
msc.begin(SD_MMC.numSectors(), SD_MMC.sectorSize());
vTaskDelay(100);
USB.begin();
USB.onEvent(usbEventCallback);
}

View File

@ -163,18 +163,7 @@ bool UpDateClassByme::CheckAndUpdate()
return true;
/* code */
}
return true;
}