Skip to content

Commit

Permalink
release R2403
Browse files Browse the repository at this point in the history
  • Loading branch information
maierkomor committed Mar 29, 2024
1 parent 24d89bb commit f589395
Show file tree
Hide file tree
Showing 168 changed files with 18,553 additions and 16,742 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
R2403:
======
- gracefully handle kiss-of-death packet of SNTP
- updated DHTxx driver
- added support for AHT10, AHT20
- added support for INA226, INA260
- added support for dynamic font loading
- added new font-tool
- added dynamic font loading support
- added font customization support
- updated fonts to include degree and copyright characters
- updated to IDF v5.1.2
- added display modes list to show only selected views
- added option to suppress Lua initialization
- screen resolution dependent font selection
- added screen customization support
(change titles, select visible modes)
- adjusted TFTP request size
- updated OPT3001 driver: interrupts and custom configuration
- fix BQ25601D watchdog handling
- fix statemachine init done before all actions are registered
- fix HT16K33 init regression

R2401:
======
- fix DS18B20 negative values
Expand Down
7 changes: 6 additions & 1 deletion Makefile.gmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ settings:
@echo IDF_VER=$(IDF_VER)
@echo CPPFLAGS=$(CPPFLAGS)

tools: mkromfs atriumcfg
tools: mkromfs atriumcfg font-tool

$(IDF_PATH):
@echo please run setupenv.sh before running make
Expand Down Expand Up @@ -185,6 +185,11 @@ atriumcfg: bin/atriumcfg$(EXEEXT)
bin/atriumcfg$(EXEEXT): $(CFG_CXX) tools/version.h tools/pcconfig.h
g++ -g -DWFC_TARGET=pc -Imain -Icomponents/wfc -Itools $(CFG_CXX) -ledit -lmd -o $@

font-tool: bin/font-tool$(EXEEXT)

bin/font-tool$(EXEEXT): tools/font-tool.c
gcc -g -I/usr/include/freetype2 tools/font-tool.c -o bin/font-tool -lfreetype

always:

tools/version.h: always
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,42 @@ and dots for OLEDs). OLEDs based on SSD1306 may also need appropriate
options for the individual hardware configuration as specified in the
ssd1306.h file. Documentation for this is on the TODO list right now.

Fonts:
======
Atrium firmware images include some basic fonts, if display support is
included, for both row-major and byte-colum-major (for OLEDs) formats.
As fonts require a lot of ROM, Atrium supports to load additional fonts
at run-time. For run-time loading the font file must be either in the ROMFS
or on a partition with FATFS/SPIFFS. Fonts on ROMFS partitions can be
loaded on all ESP32 devices. Fonts stored on FATFS or SPIFFS parttitions
can only be used if the device has an attached SPI RAM. ESP8266 devices
do not support dynamic font loading, due to limited RAM and restrictions
regarding the memory mapping of ROMFS files into the address space.

Ready to use font files are distributed as part of the source tree in
the `data/fonts` subdirectory, and in the binary distribution in the
`fonts` subdirectory. Regular row-major fonts for TFTs such as the
ILI9341 have the `.af1` extension, while fonts for OLEDs in
byte-column-major format have the `.af2` extension. Fonts that include
both formats have the `.afn` extension.

The `font-tool` utitlity can be used to create font files for Atrium
devices from regular TrueType fonts. To create font files from a `.ttf`
file, just pass the sizes as a comma separated list and the TrueType
font to the `font-tool`, and it will create the `.af1`, `.af2`, and
`.afn` files for you.

E.g.:
```
$ cd $ATRIUM_ROOT
$ make font-tool
$ bin/mkfonts.sh -s 8,12,18,24 courier.ttf
```

Fonts added to the ROMFS or root directory of FATFS/SPIFFS will be
loaded when intializing a display. They can be used either when
rendering the screen with Lua scripts or by replacing the default fonts
using the font settings in the `screen` section of the `config` command.

I/O-Extenders:
==============
Expand Down
2 changes: 1 addition & 1 deletion components/cyclic/cyclic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct SubTaskCmp
{ return l.nextrun < r.nextrun; }
};

#ifdef STATIC_TASK
#if defined ESP32 && defined STATIC_TASK
static StackType_t CyclicStack[CONFIG_CYCLIC_STACK_SIZE];
static StaticTask_t CyclicTask;
#endif
Expand Down
37 changes: 26 additions & 11 deletions components/event/event.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023, Thomas Maier-Komor
* Copyright (C) 2020-2024, Thomas Maier-Komor
* Atrium Firmware Package for ESP
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -83,9 +83,9 @@ static QueueHandle_t EventsQ = 0;
static SemaphoreHandle_t EventMtx = 0;
static vector<EventHandler> EventHandlers;
#ifdef ESP32
static atomic<uint32_t> Lost, Discarded, Invalid, Processed;
static atomic<uint32_t> Lost, Discarded, Invalid, Processed, Isr;
#else
static uint32_t Lost = 0, Discarded = 0, Invalid = 0, Processed = 0;
static uint32_t Lost = 0, Discarded = 0, Invalid = 0, Processed = 0, Isr = 0;
#endif


Expand Down Expand Up @@ -312,6 +312,19 @@ event_t event_id(const char *n)
}


void IRAM_ATTR event_isr_handler(void *arg)
{
event_t id = (event_t)(unsigned)arg;
if (id != 0) {
Event e(id);
if (pdTRUE == xQueueSendFromISR(EventsQ,&e,0))
++Isr;
else
++Lost;
}
}


const char *event_name(event_t e)
{
const char *name;
Expand Down Expand Up @@ -378,8 +391,9 @@ void IRAM_ATTR event_isr_trigger(event_t id)
// ! don't log from ISR
if (id != 0) {
Event e(id);
BaseType_t r = xQueueSendFromISR(EventsQ,&e,0);
if (r != pdTRUE)
if (pdTRUE == xQueueSendFromISR(EventsQ,&e,0))
++Isr;
else
++Lost;
}
}
Expand All @@ -390,8 +404,9 @@ void IRAM_ATTR event_isr_trigger_arg(event_t id, void *arg)
// ! don't log from ISR
if (id != 0) {
Event e(id,arg);
BaseType_t r = xQueueSendFromISR(EventsQ,&e,0);
if (r != pdTRUE)
if (pdTRUE == xQueueSendFromISR(EventsQ,&e,0))
++Isr;
else
++Lost;
}
}
Expand Down Expand Up @@ -497,11 +512,11 @@ static void event_task(void *)
void event_status(Terminal &t)
{
#ifdef ESP32
t.printf("%u processed, %u discarded, %u lost, %u invalid\n"
,Processed.load(),Discarded.load(),Lost.load(),Invalid.load());
t.printf("%u processed, %u discarded, %u lost, %u invalid, %u ISR\n"
,Processed.load(),Discarded.load(),Lost.load(),Invalid.load(),Isr.load());
#else
t.printf("%u processed, %u discarded, %u lost, %u invalid\n"
,Processed,Discarded,Lost,Invalid);
t.printf("%u processed, %u discarded, %u lost, %u invalid, %u ISR\n"
,Processed,Discarded,Lost,Invalid,Isr);
#endif
}

Expand Down
3 changes: 2 additions & 1 deletion components/event/event.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023, Thomas Maier-Komor
* Copyright (C) 2020-2024, Thomas Maier-Komor
* Atrium Firmware Package for ESP
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -89,6 +89,7 @@ void event_trigger_nd(event_t id); // no-debug version for syslog only
void event_trigger_arg(event_t e, void *);
void event_isr_trigger(event_t e);
void event_isr_trigger_arg(event_t e, void *);
void event_isr_handler(void *); // casts arg to event and calls event_isr_trigger
event_t event_id(const char *n);
const char *event_name(event_t);
uint32_t event_occur(event_t);
Expand Down
153 changes: 77 additions & 76 deletions components/logging/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,86 +19,87 @@
#include "modules.h"

const char ModNames[] =
"<undef>\0action\0adc\0ads1x\0alarms\0apds\0bh1750\0bmx\0bq25\0button\0buzzer\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\0opt3001\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";
"<undef>\0action\0adc\0ads1x\0aht\0alarms\0apds\0bh1750\0bmx\0bq25\0button\0buzzer\0cam\0ccs811b\0cfg\0con\0cyclic\0dht\0dim\0disp\0ds18b20\0event\0fs\0ftpd\0gpio\0hcsr04\0hd44780u\0hdc1000\0hlw8012\0ht16k33\0http\0i2c\0ili9341\0ina2xx\0influx\0init\0led\0ledc\0log\0lua\0lwtcp\0max7219\0mcp230xx\0mqtt\0nightsky\0ns\0nvm\0opt3001\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,
8, // action
15, // adc
19, // ads1x
25, // alarms
32, // apds
37, // bh1750
44, // bmx
48, // bq25
53, // button
60, // buzzer
67, // cam
71, // ccs811b
79, // cfg
83, // con
87, // cyclic
94, // dht
98, // dim
102, // disp
107, // ds18b20
115, // event
121, // fs
124, // ftpd
129, // gpio
134, // hcsr04
141, // hd44780u
150, // hdc1000
158, // hlw8012
166, // ht16k33
174, // http
179, // i2c
183, // ili9341
191, // ina219
198, // influx
205, // init
210, // led
214, // ledc
219, // log
223, // lua
227, // lwtcp
233, // max7219
241, // mcp230xx
250, // mqtt
255, // nightsky
264, // ns
267, // nvm
271, // opt3001
279, // ota
283, // owb
287, // pca9685
295, // pcf8574
303, // relay
309, // rgbleds
317, // romfs
323, // screen
330, // sgp30
336, // shell
342, // si7021
349, // sm
352, // sntp
357, // spi
361, // ssd130x
369, // sx1276
376, // tca9555
384, // telnet
391, // ti
394, // timefuse
403, // tlc5916
411, // tlc5947
419, // tp
422, // uart
427, // udns
432, // udpctrl
440, // usb
444, // wlan
449, // ws2812
456, // www
460, // xio
464, // xpt2046
25, // aht
29, // alarms
36, // apds
41, // bh1750
48, // bmx
52, // bq25
57, // button
64, // buzzer
71, // cam
75, // ccs811b
83, // cfg
87, // con
91, // cyclic
98, // dht
102, // dim
106, // disp
111, // ds18b20
119, // event
125, // fs
128, // ftpd
133, // gpio
138, // hcsr04
145, // hd44780u
154, // hdc1000
162, // hlw8012
170, // ht16k33
178, // http
183, // i2c
187, // ili9341
195, // ina2xx
202, // influx
209, // init
214, // led
218, // ledc
223, // log
227, // lua
231, // lwtcp
237, // max7219
245, // mcp230xx
254, // mqtt
259, // nightsky
268, // ns
271, // nvm
275, // opt3001
283, // ota
287, // owb
291, // pca9685
299, // pcf8574
307, // relay
313, // rgbleds
321, // romfs
327, // screen
334, // sgp30
340, // shell
346, // si7021
353, // sm
356, // sntp
361, // spi
365, // ssd130x
373, // sx1276
380, // tca9555
388, // telnet
395, // ti
398, // timefuse
407, // tlc5916
415, // tlc5947
423, // tp
426, // uart
431, // udns
436, // udpctrl
444, // usb
448, // wlan
453, // ws2812
460, // www
464, // xio
468, // xpt2046
};
Loading

0 comments on commit f589395

Please sign in to comment.