Skip to content

Commit

Permalink
Script config (#47)
Browse files Browse the repository at this point in the history
* stuff

* stuff

* stuff

* stuff

* stuff

* esp idf 5.2

* HTTPS default CA bundle

* IDF 5.2.1 migration
  • Loading branch information
dzurikmiroslav authored Mar 28, 2024
1 parent 70c7653 commit 9aa9c2e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.2
esp_idf_version: v5.2.1
target: ${{ matrix.platform }}

- name: Upload artifact
Expand Down
12 changes: 6 additions & 6 deletions components/config/src/board_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,28 @@ void board_config_load()
SET_CONFIG_VALUE("AUX_AIN_2", aux_ain_2, atob);
SET_CONFIG_VALUE_STR("AUX_AIN_2_NAME", aux_ain_2_name);
SET_CONFIG_VALUE("AUX_AIN_2_ADC_CHANNEL", aux_ain_2_adc_channel, atoi);
#if CONFIG_ESP_CONSOLE_UART_NUM != 0
#if CONFIG_ESP_CONSOLE_NONE || CONFIG_ESP_CONSOLE_UART_NUM != 0
SET_CONFIG_VALUE("SERIAL_1", serial_1, atoser);
SET_CONFIG_VALUE_STR("SERIAL_1_NAME", serial_1_name);
SET_CONFIG_VALUE("SERIAL_1_RXD_GPIO", serial_1_rxd_gpio, atoi);
SET_CONFIG_VALUE("SERIAL_1_TXD_GPIO", serial_1_txd_gpio, atoi);
SET_CONFIG_VALUE("SERIAL_1_RTS_GPIO", serial_1_rts_gpio, atoi);
#endif /* CONFIG_ESP_CONSOLE_UART_NUM != 0 */
#if CONFIG_ESP_CONSOLE_UART_NUM != 1
#endif /* CONFIG_ESP_CONSOLE_NONE || CONFIG_ESP_CONSOLE_UART_NUM != 0 */
#if CONFIG_ESP_CONSOLE_NONE || CONFIG_ESP_CONSOLE_UART_NUM != 1
SET_CONFIG_VALUE("SERIAL_2", serial_2, atoser);
SET_CONFIG_VALUE_STR("SERIAL_2_NAME", serial_2_name);
SET_CONFIG_VALUE("SERIAL_2_RXD_GPIO", serial_2_rxd_gpio, atoi);
SET_CONFIG_VALUE("SERIAL_2_TXD_GPIO", serial_2_txd_gpio, atoi);
SET_CONFIG_VALUE("SERIAL_2_RTS_GPIO", serial_2_rts_gpio, atoi);
#endif /* CONFIG_ESP_CONSOLE_UART_NUM != 1 */
#endif /* CONFIG_ESP_CONSOLE_NONE || CONFIG_ESP_CONSOLE_UART_NUM != 1 */
#if SOC_UART_NUM > 2
#if CONFIG_ESP_CONSOLE_UART_NUM != 2
#if CONFIG_ESP_CONSOLE_NONE || CONFIG_ESP_CONSOLE_UART_NUM != 2
SET_CONFIG_VALUE("SERIAL_3", serial_3, atoser);
SET_CONFIG_VALUE_STR("SERIAL_3_NAME", serial_3_name);
SET_CONFIG_VALUE("SERIAL_3_RXD_GPIO", serial_3_rxd_gpio, atoi);
SET_CONFIG_VALUE("SERIAL_3_TXD_GPIO", serial_3_txd_gpio, atoi);
SET_CONFIG_VALUE("SERIAL_3_RTS_GPIO", serial_3_rts_gpio, atoi);
#endif /* CONFIG_ESP_CONSOLE_UART_NUM != 2 */
#endif /* CONFIG_ESP_CONSOLE_NONE || CONFIG_ESP_CONSOLE_UART_NUM != 2 */
#endif /* SOC_UART_NUM > 2 */
SET_CONFIG_VALUE("ONEWIRE", onewire, atob);
SET_CONFIG_VALUE("ONEWIRE_GPIO", onewire_gpio, atoi);
Expand Down
4 changes: 2 additions & 2 deletions components/peripherals/src/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void adc_init(void)
ESP_LOGI(TAG, "Calibration scheme version is %s", "Curve Fitting");
adc_cali_curve_fitting_config_t cali_config = {
.unit_id = ADC_UNIT_1,
.atten = ADC_ATTEN_DB_11,
.atten = ADC_ATTEN_DB_12,
.bitwidth = ADC_BITWIDTH_DEFAULT,
};
if (adc_cali_create_scheme_curve_fitting(&cali_config, &adc_cali_handle) == ESP_OK) {
Expand All @@ -35,7 +35,7 @@ void adc_init(void)
ESP_LOGI(TAG, "Calibration scheme version is %s", "Line Fitting");
adc_cali_line_fitting_config_t cali_config = {
.unit_id = ADC_UNIT_1,
.atten = ADC_ATTEN_DB_11,
.atten = ADC_ATTEN_DB_12,
.bitwidth = ADC_BITWIDTH_DEFAULT,
#if CONFIG_IDF_TARGET_ESP32
.default_vref = 1100
Expand Down
2 changes: 1 addition & 1 deletion components/peripherals/src/aux_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void aux_init(void)

adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = ADC_ATTEN_DB_11
.atten = ADC_ATTEN_DB_12
};

if (board_config.aux_ain_1) {
Expand Down
2 changes: 1 addition & 1 deletion components/peripherals/src/energy_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void energy_meter_init(void)
nvs_get_u16(nvs, NVS_AC_VOLTAGE, &ac_voltage);
adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = ADC_ATTEN_DB_11
.atten = ADC_ATTEN_DB_12
};

if (board_config.energy_meter == BOARD_CONFIG_ENERGY_METER_CUR) {
Expand Down
2 changes: 1 addition & 1 deletion components/peripherals/src/pilot.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void pilot_init(void)

adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = ADC_ATTEN_DB_11
.atten = ADC_ATTEN_DB_12
};
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc_handle, board_config.pilot_adc_channel, &config));
}
Expand Down
2 changes: 1 addition & 1 deletion components/peripherals/src/proximity.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void proximity_init(void)
if (board_config.proximity) {
adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = ADC_ATTEN_DB_11
.atten = ADC_ATTEN_DB_12
};
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc_handle, board_config.proximity_adc_channel, &config));
}
Expand Down
3 changes: 1 addition & 2 deletions components/protocols/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ set(srcs
"src/scheduler.c")

set(embed_files
"web.cpio"
"server_certs/ca_cert.pem")
"web.cpio")

idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
Expand Down
22 changes: 0 additions & 22 deletions components/protocols/server_certs/ca_cert.pem

This file was deleted.

10 changes: 3 additions & 7 deletions components/protocols/src/http_rest.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "esp_ota_ops.h"
#include "esp_https_ota.h"
#include "esp_vfs.h"
#include "esp_crt_bundle.h"
#include "cJSON.h"

#include "http_rest.h"
Expand All @@ -29,9 +30,6 @@

static const char* TAG = "http_rest";

extern const char server_cert_pem_start[] asm("_binary_ca_cert_pem_start");
extern const char server_cert_pem_end[] asm("_binary_ca_cert_pem_end");

static void restart_func(void* arg)
{
vTaskDelay(pdMS_TO_TICKS(5000));
Expand Down Expand Up @@ -104,7 +102,7 @@ static esp_err_t ota_get_available_version(char* version)
{
esp_http_client_config_t config = {
.url = OTA_VERSION_URL,
.cert_pem = server_cert_pem_start
.crt_bundle_attach = esp_crt_bundle_attach
};

esp_http_client_handle_t client = esp_http_client_init(&config);
Expand Down Expand Up @@ -377,11 +375,9 @@ esp_err_t firmware_update_post_handler(httpd_req_t* req)
const esp_app_desc_t* app_desc = esp_app_get_description();

if (ota_is_newer_version(app_desc->version, avl_version)) {
extern const char server_cert_pem_start[] asm("_binary_ca_cert_pem_start");

esp_http_client_config_t http_config = {
.url = OTA_FIRMWARE_URL CONFIG_IDF_TARGET "-evse.bin",
.cert_pem = server_cert_pem_start
.crt_bundle_attach = esp_crt_bundle_attach
};

esp_https_ota_config_t config = {
Expand Down

0 comments on commit 9aa9c2e

Please sign in to comment.