Skip to content

Commit

Permalink
CI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dzurikmiroslav committed Dec 31, 2024
1 parent 0aa550d commit f410560
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 22 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,30 @@ jobs:
esp_idf_version: ${{ needs.env.outputs.esp_idf_version }}
target: ${{ matrix.platform }}

- name: Rename file
shell: bash
run: cp build/esp32-evse.bin ${{ matrix.platform }}-evse.bin
- name: Merge factory
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: ${{ needs.env.outputs.esp_idf_version }}
target: ${{ matrix.platform }}
command: esptool.py --chip ${{ matrix.platform }} merge_bin -o build/${{ matrix.platform }}-evse.factory.bin --flash_mode dio --flash_freq 40m --flash_size 4MB \
0x1000 build/bootloader/bootloader.bin \
0x10000 build/esp32-evse.bin \
0x8000 build/partition_table/partition-table.bin \
0xd000 build/ota_data_initial.bin

- name: Upload artifact
- name: Rename file bin
shell: bash
run: cp build/esp32-evse.bin build/${{ matrix.platform }}-evse.bin

- name: Upload artifact bin
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.platform }}
path: ${{ matrix.platform }}-evse.bin
path: build/${{ matrix.platform }}-evse.bin

- name: Upload artifact factory
uses: actions/upload-artifact@v4
with:
name: factory-${{ matrix.platform }}
path: build/${{ matrix.platform }}-evse.factory.bin

29 changes: 19 additions & 10 deletions components/script/src/l_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static component_list_t* get_component_list(lua_State* L)
return component_list;
}

static int l_add_component(lua_State* L)
static int l_register(lua_State* L)
{
luaL_argcheck(L, lua_istable(L, 1), 1, "must be table");

Expand Down Expand Up @@ -225,7 +225,7 @@ static int l_add_component(lua_State* L)
return 0;
}

static int l_component_gc(lua_State* L)
static int l_gc(lua_State* L)
{
component_list_t* component_list = get_component_list(L);

Expand All @@ -242,21 +242,30 @@ static int l_component_gc(lua_State* L)
return 0;
}

void l_component_register(lua_State* L)
static const luaL_Reg lib[] = {
{ "register", l_register },
{ NULL, NULL },
};

static const luaL_Reg metadata[] = {
{ "__index", NULL },
{ "__gc", l_gc },
{ NULL, NULL },
};

int luaopen_component(lua_State* L)
{
lua_pushcfunction(L, l_add_component);
lua_setglobal(L, "addcomponent");
luaL_newlib(L, lib);

component_list_t* components = (component_list_t*)lua_newuserdata(L, sizeof(component_list_t));
SLIST_INIT(components);
components_ref = luaL_ref(L, LUA_REGISTRYINDEX);

luaL_newmetatable(L, "component");
lua_pushcfunction(L, l_component_gc);
lua_setfield(L, -2, "__gc");
luaL_setfuncs(L, metadata, 0);
lua_setmetatable(L, -1);

lua_setmetatable(L, -2);

components_ref = luaL_ref(L, LUA_REGISTRYINDEX);
return 1;
}

void l_component_resume(lua_State* L)
Expand Down
2 changes: 1 addition & 1 deletion components/script/src/l_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "lua.h"
#include "script.h"

void l_component_register(lua_State* L);
int luaopen_component(lua_State* L);

void l_component_resume(lua_State* L);

Expand Down
5 changes: 3 additions & 2 deletions components/script/src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ static void script_task_func(void* param)

luaL_openlibs(L);

l_component_register(L);
luaL_requiref(L, "component", luaopen_component, 1);
lua_pop(L, 1);

luaL_requiref(L, "evse", luaopen_evse, 1);
luaL_requiref(L, "evse", luaopen_evse, 0);
lua_pop(L, 1);

luaL_requiref(L, "mqtt", luaopen_mqtt, 0);
Expand Down
2 changes: 1 addition & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static void update_leds(void)
void app_main(void)
{
logger_init();
// esp_log_set_vprintf(logger_vprintf);
esp_log_set_vprintf(logger_vprintf);

const esp_partition_t* running = esp_ota_get_running_partition();
ESP_LOGI(TAG, "Running partition: %s", running->label);
Expand Down
2 changes: 1 addition & 1 deletion test_app/main/script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ paramstring1 = "init"
paramnumber1 = "init"
paramboolean1 = "init"

addcomponent({
component.register({
id = "component1",
name = "Test component 1",
description = "The test component 1",
Expand Down
3 changes: 2 additions & 1 deletion test_app/main/test_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ TEST_SETUP(script)

luaL_openlibs(L);

l_component_register(L);
luaL_requiref(L, "component", luaopen_component, 1);
lua_pop(L, 1);

luaL_requiref(L, "evse", luaopen_evse, 1);
lua_pop(L, 1);
Expand Down
2 changes: 1 addition & 1 deletion test_app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bitarray==2.9.2
bitstring==4.1.4
cffi==1.16.0
colorama==0.4.6
cryptography==43.0.1
cryptography==41.0.7
ecdsa==0.18.0
esp-idf-panic-decoder==1.0.1
esptool==4.7.0
Expand Down

0 comments on commit f410560

Please sign in to comment.