Skip to content

Commit

Permalink
release R2306
Browse files Browse the repository at this point in the history
  • Loading branch information
maierkomor committed Jul 2, 2023
1 parent cd2d08b commit c915ded
Show file tree
Hide file tree
Showing 85 changed files with 9,154 additions and 1,248 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
R2306:
======
- fix: enable/disable at-jobs not working as expected
- create static tasks with static memory
- removed obsolete socket-based inetd
- fix: default S2(uart)/S3(jtag) console config
- fix: S2/S3 GPIO ranges
- added ILI9341 driver
- added XPT2046 driver

R2305:
======
- support to list root directory
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ About Atrium Firmware:
======================
Atrium Firmware is software stack for the ESP family of controllers from
Espressif. It provides ready to build configuration (e.g. for S20
socket) and supports ESP8285, ESP8266, ESP32, ESP32-C3, and ESP32-S3 in
one source code package, providing infrastructure to build, configure,
and use the devices in a consistent manner.
socket) and supports ESP8285, ESP8266, ESP32, ESP32-C3, ESP32-S2, and
ESP32-S3 in one source code package, providing infrastructure to build,
configure, and use the devices in a consistent manner.

The intended audience of this distribution are enthusiasts and hobbyists
that want a home-automation without cloud access. For remote operation
Expand Down
18 changes: 18 additions & 0 deletions components/cyclic/cyclic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,20 @@

#include <vector>

#if!defined APP_CPU_NUM || defined CONFIG_FREERTOS_UNICORE
#define CYCLIC_CPU_NUM 0
#else
#define CYCLIC_CPU_NUM APP_CPU_NUM
#endif

#ifndef CONFIG_CYCLIC_STACK_SIZE
#define CONFIG_CYCLIC_STACK_SIZE 4096
#endif

using namespace std;

#define TAG MODULE_CYCLIC
#define STATIC_TASK

struct SubTask
{
Expand Down Expand Up @@ -71,6 +81,10 @@ struct SubTaskCmp
{ return l.nextrun < r.nextrun; }
};

#ifdef STATIC_TASK
static StackType_t CyclicStack[CONFIG_CYCLIC_STACK_SIZE];
static StaticTask_t CyclicTask;
#endif

static SubTask *SubTasks = 0;
static SemaphoreHandle_t Mtx = 0;
Expand Down Expand Up @@ -182,9 +196,13 @@ void cyclic_setup()
{
Mtx = xSemaphoreCreateMutex();
#ifdef ESP32
#ifdef STATIC_TASK
xTaskCreateStaticPinnedToCore(cyclic_task, "cyclic", sizeof(CyclicStack), (void*)0, 20, CyclicStack, &CyclicTask, CYCLIC_CPU_NUM);
#else
BaseType_t r = xTaskCreatePinnedToCore(cyclic_task, "cyclic", 8192, (void*)0, 20, NULL, 1);
if (r != pdPASS)
log_error(TAG,"create task: %d",r);
#endif // STATIC_TASK
#else
// cyclic_execute is called from the event task
#endif
Expand Down
24 changes: 23 additions & 1 deletion components/event/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@

using namespace std;

#define TAG MODULE_EVENT
#define STATIC_TASK

#if!defined APP_CPU_NUM || defined CONFIG_FREERTOS_UNICORE
#define EVENT_CPU_NUM 0
#else
#define EVENT_CPU_NUM APP_CPU_NUM
#endif

#if 0
#define log_devel log_dbug
#else
Expand All @@ -51,6 +60,10 @@ extern "C" void busy_set(int on);
#define busy_set(...)
#endif

#ifndef CONFIG_EVENT_STACK_SIZE
#define CONFIG_EVENT_STACK_SIZE 8192
#endif


struct Event {
event_t id;
Expand All @@ -61,11 +74,14 @@ struct Event {
{ }
};

#if defined STATIC_TASK && !defined CONFIG_IDF_TARGET_ESP8266
static StackType_t EventStack[CONFIG_EVENT_STACK_SIZE];
static StaticTask_t EventTask;
#endif

static QueueHandle_t EventsQ = 0;
static SemaphoreHandle_t EventMtx = 0;
static vector<EventHandler> EventHandlers;
#define TAG MODULE_EVENT
#ifdef ESP32
static atomic<uint32_t> Lost, Discarded, Invalid, Processed;
#else
Expand Down Expand Up @@ -500,10 +516,16 @@ void event_init(void)

int event_start(void)
{
#ifdef CONFIG_IDF_TARGET_ESP8266
xTaskCreate(&event_task, "events", CONFIG_EVENT_STACK_SIZE, (void*)0, 9, 0);
#elif defined STATIC_TASK
xTaskCreateStaticPinnedToCore(&event_task, "events", sizeof(EventStack), (void*)0, 9, EventStack, &EventTask, EVENT_CPU_NUM);
#else
BaseType_t r = xTaskCreatePinnedToCore(&event_task, "events", 8*1024, (void*)0, 9, NULL, 1);
if (r != pdPASS) {
log_error(TAG,"create task: %d",r);
return 1;
}
#endif
return 0;
}
51 changes: 24 additions & 27 deletions components/logging/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@ const char UartPrefix[][8] = {

void con_print(const char *str)
{
if (str == 0)
return;
size_t s = strlen(str);
#if CONFIG_CONSOLE_UART_NONE != 1
if ((LogUart != -1) && (str != 0)) {
size_t s = strlen(str);
if ((LogUart != -1) && (s != 0)) {
if (pdFALSE == xSemaphoreTake(UartLock,MUTEX_ABORT_TIMEOUT))
abort_on_mutex(UartLock,__FUNCTION__);
uart_write_bytes(LogUart,str,s);
Expand All @@ -129,53 +131,45 @@ void con_print(const char *str)
xSemaphoreGive(UartLock);
}
#endif
#ifdef CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
#if defined CONFIG_USB_DIAGLOG && (defined CONFIG_IDF_TARGET_ESP32C3 || defined CONFIG_IDF_TARGET_ESP32S3)
// will block until a jtag connection is present
// therefore, max delay: 10ms
usb_serial_jtag_write_bytes(str,strlen(str),10);
usb_serial_jtag_write_bytes(str,s,10);
usb_serial_jtag_write_bytes("\r\n",2,10);
#endif
}


void con_printf(const char *f, ...)
{
#if CONFIG_CONSOLE_UART_NONE != 1
if (LogUart == -1)
return;
char buf[256];
va_list val;
va_start(val,f);
int n = vsnprintf(buf,sizeof(buf),f,val);
con_printv(f,val);
va_end(val);
if (n > 0) {
if (n > sizeof(buf))
n = sizeof(buf);
con_write(buf,n);
//uart_wait_tx_done((uart_port_t)LogUart,portMAX_DELAY);
}
#endif
}


void con_printv(const char *f, va_list val)
{
#if CONFIG_CONSOLE_UART_NONE != 1
if (LogUart == -1)
return;
char buf[256];
int n = vsnprintf(buf,sizeof(buf),f,val);
if (n > 0) {
if (n > sizeof(buf))
n = sizeof(buf);
if (pdFALSE == xSemaphoreTake(UartLock,MUTEX_ABORT_TIMEOUT))
abort_on_mutex(UartLock,__FUNCTION__);
uart_write_bytes(LogUart,buf,n);
uart_write_bytes(LogUart,"\r\n",2);
uart_wait_tx_done((uart_port_t)LogUart,portMAX_DELAY);
xSemaphoreGive(UartLock);
}
#if CONFIG_CONSOLE_UART_NONE != 1
if (LogUart != -1) {
if (pdFALSE == xSemaphoreTake(UartLock,MUTEX_ABORT_TIMEOUT))
abort_on_mutex(UartLock,__FUNCTION__);
uart_write_bytes(LogUart,buf,n);
uart_write_bytes(LogUart,"\r\n",2);
uart_wait_tx_done((uart_port_t)LogUart,portMAX_DELAY);
xSemaphoreGive(UartLock);
}
#endif
#ifdef CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
usb_serial_jtag_write_bytes(buf,n,portMAX_DELAY);
#endif
}
}


Expand All @@ -188,6 +182,9 @@ void con_write(const char *str, ssize_t s)
xSemaphoreGive(UartLock);
}
#endif
#ifdef CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
usb_serial_jtag_write_bytes(str,s,portMAX_DELAY);
#endif
}


Expand Down Expand Up @@ -304,7 +301,7 @@ void log_common(log_level_t l, logmod_t m, const char *f, va_list val)
if (pdTRUE != xSemaphoreTake(UartLock,MUTEX_ABORT_TIMEOUT))
abort_on_mutex(UartLock,__BASE_FILE__);
uart_write_bytes((uart_port_t)LogUart,buf,s);
if (l <= ll_warn)
// if (l <= ll_warn)
uart_wait_tx_done((uart_port_t)LogUart,portMAX_DELAY);
xSemaphoreGive(UartLock);
}
Expand Down
95 changes: 48 additions & 47 deletions components/logging/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "modules.h"

const char ModNames[] =
"<undef>\0action\0adc\0alarms\0apds\0bh1750\0bmx\0button\0cam\0ccs811b\0cfg\0con\0cyclic\0dht\0dim\0disp\0ds18b20\0event\0fs\0ftpd\0gpio\0hcsr04\0hd44780u\0hdc1000\0hlw8012\0ht16k33\0http\0i2c\0ina219\0inetd\0influx\0init\0led\0ledc\0log\0lua\0lwtcp\0max7219\0mcp230xx\0mqtt\0nightsky\0ns\0nvm\0ota\0owb\0pca9685\0pcf8574\0relay\0rgbleds\0romfs\0screen\0sgp30\0shell\0si7021\0sm\0sntp\0spi\0ssd130x\0sx1276\0tca9555\0telnet\0ti\0timefuse\0tlc5916\0tlc5947\0tp\0uart\0udns\0udpctrl\0usb\0wlan\0ws2812\0www\0xio\0";
"<undef>\0action\0adc\0alarms\0apds\0bh1750\0bmx\0button\0cam\0ccs811b\0cfg\0con\0cyclic\0dht\0dim\0disp\0ds18b20\0event\0fs\0ftpd\0gpio\0hcsr04\0hd44780u\0hdc1000\0hlw8012\0ht16k33\0http\0i2c\0ili9341\0ina219\0influx\0init\0led\0ledc\0log\0lua\0lwtcp\0max7219\0mcp230xx\0mqtt\0nightsky\0ns\0nvm\0ota\0owb\0pca9685\0pcf8574\0relay\0rgbleds\0romfs\0screen\0sgp30\0shell\0si7021\0sm\0sntp\0spi\0ssd130x\0sx1276\0tca9555\0telnet\0ti\0timefuse\0tlc5916\0tlc5947\0tp\0uart\0udns\0udpctrl\0usb\0wlan\0ws2812\0www\0xio\0xpt2046\0";

const uint16_t ModNameOff[] = {
0,
Expand Down Expand Up @@ -50,50 +50,51 @@ const uint16_t ModNameOff[] = {
148, // ht16k33
156, // http
161, // i2c
165, // ina219
172, // inetd
178, // influx
185, // init
190, // led
194, // ledc
199, // log
203, // lua
207, // lwtcp
213, // max7219
221, // mcp230xx
230, // mqtt
235, // nightsky
244, // ns
247, // nvm
251, // ota
255, // owb
259, // pca9685
267, // pcf8574
275, // relay
281, // rgbleds
289, // romfs
295, // screen
302, // sgp30
308, // shell
314, // si7021
321, // sm
324, // sntp
329, // spi
333, // ssd130x
341, // sx1276
348, // tca9555
356, // telnet
363, // ti
366, // timefuse
375, // tlc5916
383, // tlc5947
391, // tp
394, // uart
399, // udns
404, // udpctrl
412, // usb
416, // wlan
421, // ws2812
428, // www
432, // xio
165, // ili9341
173, // ina219
180, // influx
187, // init
192, // led
196, // ledc
201, // log
205, // lua
209, // lwtcp
215, // max7219
223, // mcp230xx
232, // mqtt
237, // nightsky
246, // ns
249, // nvm
253, // ota
257, // owb
261, // pca9685
269, // pcf8574
277, // relay
283, // rgbleds
291, // romfs
297, // screen
304, // sgp30
310, // shell
316, // si7021
323, // sm
326, // sntp
331, // spi
335, // ssd130x
343, // sx1276
350, // tca9555
358, // telnet
365, // ti
368, // timefuse
377, // tlc5916
385, // tlc5947
393, // tp
396, // uart
401, // udns
406, // udpctrl
414, // usb
418, // wlan
423, // ws2812
430, // www
434, // xio
438, // xpt2046
};
10 changes: 6 additions & 4 deletions components/logging/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ typedef enum logmod_e {
logmod_ht16k33,
logmod_http,
logmod_i2c,
logmod_ili9341,
logmod_ina219,
logmod_inetd,
logmod_influx,
logmod_init,
logmod_led,
Expand Down Expand Up @@ -102,6 +102,7 @@ typedef enum logmod_e {
logmod_ws2812,
logmod_www,
logmod_xio,
logmod_xpt2046,
} logmod_t;

// module defines
Expand Down Expand Up @@ -132,8 +133,8 @@ typedef enum logmod_e {
#define MODULE_HT16K33 logmod_ht16k33
#define MODULE_HTTP logmod_http
#define MODULE_I2C logmod_i2c
#define MODULE_ILI9341 logmod_ili9341
#define MODULE_INA219 logmod_ina219
#define MODULE_INETD logmod_inetd
#define MODULE_INFLUX logmod_influx
#define MODULE_INIT logmod_init
#define MODULE_LED logmod_led
Expand Down Expand Up @@ -178,8 +179,9 @@ typedef enum logmod_e {
#define MODULE_WS2812 logmod_ws2812
#define MODULE_WWW logmod_www
#define MODULE_XIO logmod_xio
#define MAX_MODULE_ID 73
#define NUM_MODULES 74
#define MODULE_XPT2046 logmod_xpt2046
#define MAX_MODULE_ID 74
#define NUM_MODULES 75

#ifdef USE_MODULE
#define TAG USE_MODULE
Expand Down
Loading

0 comments on commit c915ded

Please sign in to comment.