Update OTA code

This commit is contained in:
Manticore 2025-02-27 16:23:45 +05:30
parent 2f1c9fedc8
commit 7e2a7a567c
8 changed files with 28 additions and 26 deletions

View File

@ -2121,5 +2121,3 @@ int comms_get_status(void)
__attribute__((weak)) void comms_ready_cb(void) { } __attribute__((weak)) void comms_ready_cb(void) { }

View File

@ -48,7 +48,7 @@
#define PARTHA_SERVER_BASE_URL "https://www.parthasarathimishra.com" #define PARTHA_SERVER_BASE_URL "https://www.parthasarathimishra.com"
#define TESTING_SERVER_BASE_URL "http://3.90.70.38:8080" #define TESTING_SERVER_BASE_URL "http://54.204.230.201:8085"
typedef enum typedef enum
@ -102,24 +102,25 @@ typedef enum
#define MCU_GET_SETTINGS_URL3 TESTING_SERVER_BASE_URL//settings/server3 #define MCU_GET_SETTINGS_URL3 TESTING_SERVER_BASE_URL//settings/server3
//URL to get MCU FW version from servers 1, 2, and 3 //URL to get MCU FW version from servers 1, 2, and 3
#define MCU_FW_VERSION_URL1 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/mcu_pgm_download/version/"/*MCU_BASE_URL1//mcu/fw/version/server1*/ #define MCU_FW_VERSION_URL1 TESTING_SERVER_BASE_URL"/hae/azuma/%s/mcu_pgm_download/version/"/*MCU_BASE_URL1//mcu/fw/version/server1*/
#define MCU_FW_VERSION_URL2 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/mcu_pgm_download/version/"//MCU_BASE_URL2//mcu/fw/version/server2 #define MCU_FW_VERSION_URL2 TESTING_SERVER_BASE_URL"/hae/azuma/%s/mcu_pgm_download/version/"//MCU_BASE_URL2//mcu/fw/version/server2
#define MCU_FW_VERSION_URL3 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/mcu_pgm_download/version/"//MCU_BASE_URL3//mcu/fw/version/server3 #define MCU_FW_VERSION_URL3 TESTING_SERVER_BASE_URL"/hae/azuma/%s/mcu_pgm_download/version/"//MCU_BASE_URL3//mcu/fw/version/server3
//URL to get MCU FW bin file from servers 1, 2, and 3 //URL to get MCU FW bin file from servers 1, 2, and 3
#define MCU_FW_BIN_FILE_URL1 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/mcu_pgm_download/OTA.bin"//MCU_BASE_URL1//mcu/fw/bin/file/server1 #define MCU_FW_BIN_FILE_URL1 TESTING_SERVER_BASE_URL"/hae/azuma/%s/mcu_pgm_download/OTA.bin"//MCU_BASE_URL1//mcu/fw/bin/file/server1
#define MCU_FW_BIN_FILE_URL2 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/mcu_pgm_download/OTA.bin"//MCU_BASE_URL2//mcu/fw/bin/file/server2 #define MCU_FW_BIN_FILE_URL2 TESTING_SERVER_BASE_URL"/hae/azuma/%s/mcu_pgm_download/OTA.bin"//MCU_BASE_URL2//mcu/fw/bin/file/server2
#define MCU_FW_BIN_FILE_URL3 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/mcu_pgm_download/OTA.bin"//MCU_BASE_URL3//mcu/fw/bin/file/server3 #define MCU_FW_BIN_FILE_URL3 TESTING_SERVER_BASE_URL"/hae/azuma/%s/mcu_pgm_download/OTA.bin"//MCU_BASE_URL3//mcu/fw/bin/file/server3
//URL to get MODEM FW version from servers 1, 2, and 3 //URL to get MODEM FW version from servers 1, 2, and 3
#define MODEM_FW_VERSION_URL1 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/modem_pgm_download/version/"//MCU_BASE_URL1//modem/fw/version/server1 #define MODEM_FW_VERSION_URL1 TESTING_SERVER_BASE_URL"/hae/azuma/%s/modem_pgm_download/version/"//MCU_BASE_URL1//modem/fw/version/server1
#define MODEM_FW_VERSION_URL2 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/modem_pgm_download/version/"//MCU_BASE_URL2//modem/fw/version/server2 #define MODEM_FW_VERSION_URL2 TESTING_SERVER_BASE_URL"/hae/azuma/%s/modem_pgm_download/version/"//MCU_BASE_URL2//modem/fw/version/server2
#define MODEM_FW_VERSION_URL3 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/modem_pgm_download/version/"//MCU_BASE_URL3//modem/fw/version/server3 #define MODEM_FW_VERSION_URL3 TESTING_SERVER_BASE_URL"/hae/azuma/%s/modem_pgm_download/version/"//MCU_BASE_URL3//modem/fw/version/server3
//URL to get MODEM FW bin file from servers 1, 2, and 3 //URL to get MODEM FW bin file from servers 1, 2, and 3
#define MODEM_FW_BIN_FILE_URL1 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/modem_pgm_download/MOTA.bin"//MCU_BASE_URL1//modem/fw/bin/file/server1 #define MODEM_FW_BIN_FILE_URL1 TESTING_SERVER_BASE_URL"/hae/azuma/%s/modem_pgm_download/MOTA.bin"//MCU_BASE_URL1//modem/fw/bin/file/server1
#define MODEM_FW_BIN_FILE_URL2 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/modem_pgm_download/MOTA.bin"//MCU_BASE_URL2//modem/fw/bin/file/server2 #define MODEM_FW_BIN_FILE_URL2 TESTING_SERVER_BASE_URL"/hae/azuma/%s/modem_pgm_download/MOTA.bin"//MCU_BASE_URL2//modem/fw/bin/file/server2
#define MODEM_FW_BIN_FILE_URL3 TESTING_SERVER_BASE_URL"/hae/tempstick/%s/modem_pgm_download/MOTA.bin"//MCU_BASE_URL3//modem/fw/bin/file/server3 #define MODEM_FW_BIN_FILE_URL3 TESTING_SERVER_BASE_URL"/hae/azuma/%s/modem_pgm_download/MOTA.bin"//MCU_BASE_URL3//modem/fw/bin/file/server3
#else #else

View File

@ -11,6 +11,9 @@
#include "main.h" #include "main.h"
#include "ota.h" #include "ota.h"
#include "MCP39F501.h" #include "MCP39F501.h"
#include "wifi_OTA.h"
#define IMEI "353165803930522"
static const char* TAG = "MAIN"; static const char* TAG = "MAIN";
uint8_t comms_mode = DEFAULT_COMMS_MODE; uint8_t comms_mode = DEFAULT_COMMS_MODE;
@ -24,6 +27,7 @@ void app_main(void)
port_init(); port_init();
uart_ifx_init(); uart_ifx_init();
/* Create the UART tasks for both UART0 and UART1 */ /* Create the UART tasks for both UART0 and UART1 */
uart_create_rx_tasks(); uart_create_rx_tasks();
@ -38,7 +42,6 @@ void app_main(void)
/* Wait till the onboarding process is completed */ /* Wait till the onboarding process is completed */
while(!webserver_get_status()) while(!webserver_get_status())
{ {
//ESP_LOGI(TAG," -------------> PASSWORD is: %s",wifi_get_pswd());
vTaskDelay(750/portTICK_PERIOD_MS); vTaskDelay(750/portTICK_PERIOD_MS);
port_red_led_toggle(); port_red_led_toggle();
@ -48,12 +51,11 @@ void app_main(void)
ESP_LOGI(TAG," -------------> Wifi Connected ... :)"); ESP_LOGI(TAG," -------------> Wifi Connected ... :)");
port_blue_led_on(); port_blue_led_on();
// OTA configure // wifi_ota_start_firmware_update(IMEI);
// ota_init();
//nvm_clear();
while(1){ while(1){
vTaskDelay(1 / portTICK_PERIOD_MS); vTaskDelay(100 / portTICK_PERIOD_MS);
} }
vTaskDelete(NULL); vTaskDelete(NULL);
} }

View File

@ -493,6 +493,7 @@ void nvm_write_wifi_credentials(char* ssid, uint8_t ssid_len, char* pswd, uint8_
//ESP_LOGI(TAG,"Committing updates in NVS ... "); //ESP_LOGI(TAG,"Committing updates in NVS ... ");
err = nvs_commit(my_handle); err = nvs_commit(my_handle);
vTaskDelay(100 / portTICK_PERIOD_MS);
if (err != ESP_OK) if (err != ESP_OK)
{ {

View File

@ -16,9 +16,9 @@
#define SET_SECOND 0 /*< Set second to the RTC */ #define SET_SECOND 0 /*< Set second to the RTC */
#define SET_WEEKDAY 3 /*< Set weekday to the RTC */ #define SET_WEEKDAY 3 /*< Set weekday to the RTC */
#define SET_YEARDAY 16 /*< day in the year, range 0 to 365 */ #define SET_YEARDAY 16 /*< day in the year, range 0 to 365 */
#define SET_DAY 16 /*< Set day to the RTC */ #define SET_DAY 26 /*< Set day to the RTC */
#define SET_MONTH 1 /*< Set month to the RTC */ #define SET_MONTH 2 /*< Set month to the RTC */
#define SET_YEAR 2023 /*< Set year to the RTC */ #define SET_YEAR 2025 /*< Set year to the RTC */
#define RTC_SUBSECOND_COUNTER_LOAD_VALUE 32767 #define RTC_SUBSECOND_COUNTER_LOAD_VALUE 32767

View File

@ -4,4 +4,4 @@ nvs, data, nvs,0x9000, 0x14000,
otadata, data, ota,0x1d000, 0x2000, otadata, data, ota,0x1d000, 0x2000,
phy_init, data, phy,0x1f000, 0x1000, phy_init, data, phy,0x1f000, 0x1000,
ota_0, app, ota_0,0x20000,0x1a0000, ota_0, app, ota_0,0x20000,0x1a0000,
ota_1, app, ota_1,0x1c0000,0x1a0000, ota_1, app, ota_1,0x1c0000,0x1a0000,
1 # ESP-IDF Partition Table
4 otadata data ota 0x1d000 0x2000
5 phy_init data phy 0x1f000 0x1000
6 ota_0 app ota_0 0x20000 0x1a0000
7 ota_1 app ota_1 0x1c0000 0x1a0000

View File

@ -447,7 +447,7 @@ CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y # CONFIG_PARTITION_TABLE_MD5 is not set
# end of Partition Table # end of Partition Table
# #

View File

@ -296,7 +296,7 @@ CONFIG_IDF_TOOLCHAIN="gcc"
CONFIG_IDF_TARGET_ARCH_XTENSA=y CONFIG_IDF_TARGET_ARCH_XTENSA=y
CONFIG_IDF_TARGET_ARCH="xtensa" CONFIG_IDF_TARGET_ARCH="xtensa"
CONFIG_IDF_TARGET="esp32s2" CONFIG_IDF_TARGET="esp32s2"
CONFIG_IDF_INIT_VERSION="5.3.1" CONFIG_IDF_INIT_VERSION="$IDF_INIT_VERSION"
CONFIG_IDF_TARGET_ESP32S2=y CONFIG_IDF_TARGET_ESP32S2=y
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0002 CONFIG_IDF_FIRMWARE_CHIP_ID=0x0002