Let ESP IDF manage app version
This commit is contained in:
		
							
								
								
									
										3
									
								
								esp32_device/.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								esp32_device/.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@@ -53,6 +53,7 @@
 | 
				
			|||||||
    "sync_response.h": "c",
 | 
					    "sync_response.h": "c",
 | 
				
			||||||
    "gpio.h": "c",
 | 
					    "gpio.h": "c",
 | 
				
			||||||
    "esp_system.h": "c",
 | 
					    "esp_system.h": "c",
 | 
				
			||||||
    "relays.h": "c"
 | 
					    "relays.h": "c",
 | 
				
			||||||
 | 
					    "esp_app_desc.h": "c"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,11 +5,6 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
#define DEV_REFERENCE "Wt32-Eth01"
 | 
					#define DEV_REFERENCE "Wt32-Eth01"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Device version
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define DEV_VERSION "0.0.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Backend unsecure API URL
 | 
					 * Backend unsecure API URL
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include "esp_system.h"
 | 
					#include "esp_system.h"
 | 
				
			||||||
#include "esp_log.h"
 | 
					#include "esp_log.h"
 | 
				
			||||||
 | 
					#include "esp_app_desc.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "dev_name.h"
 | 
					#include "dev_name.h"
 | 
				
			||||||
#include "storage.h"
 | 
					#include "storage.h"
 | 
				
			||||||
@@ -20,7 +21,7 @@ void app_main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    system_show_free_memory();
 | 
					    system_show_free_memory();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ESP_LOGI(TAG, "SolarEnergy WT32-ETH01 device");
 | 
					    ESP_LOGI(TAG, "SolarEnergy WT32-ETH01 device version %s", esp_app_get_description()->version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Turn off all relays
 | 
					    // Turn off all relays
 | 
				
			||||||
    relays_turn_off_all();
 | 
					    relays_turn_off_all();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,7 @@
 | 
				
			|||||||
#include "relays.h"
 | 
					#include "relays.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "esp_log.h"
 | 
					#include "esp_log.h"
 | 
				
			||||||
 | 
					#include "esp_app_desc.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *TAG = "secure_api";
 | 
					static const char *TAG = "secure_api";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -118,11 +119,13 @@ fail:
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static cJSON *genDevInfo()
 | 
					static cJSON *genDevInfo()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    const esp_app_desc_t *desc = esp_app_get_description();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cJSON *json = cJSON_CreateObject();
 | 
					    cJSON *json = cJSON_CreateObject();
 | 
				
			||||||
    if (!json)
 | 
					    if (!json)
 | 
				
			||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
    cJSON_AddStringToObject(json, "reference", DEV_REFERENCE);
 | 
					    cJSON_AddStringToObject(json, "reference", DEV_REFERENCE);
 | 
				
			||||||
    cJSON_AddStringToObject(json, "version", DEV_VERSION);
 | 
					    cJSON_AddStringToObject(json, "version", desc->version);
 | 
				
			||||||
    cJSON_AddNumberToObject(json, "max_relays", relays_count());
 | 
					    cJSON_AddNumberToObject(json, "max_relays", relays_count());
 | 
				
			||||||
    return json;
 | 
					    return json;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								esp32_device/version.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								esp32_device/version.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					1.0.0
 | 
				
			||||||
		Reference in New Issue
	
	Block a user