Commit Graph

76 Commits (master)
 

Author SHA1 Message Date
alex 81db4aaa71
ci: add sha256sum output for aarch64 build
ci/woodpecker/push/woodpecker Pipeline was successful Details
the goal is reproducible builds.
1 year ago
alex f1784cb39d
ngui: add a way to limit LVGL logging verbosity
ci/woodpecker/push/woodpecker Pipeline was successful Details
the commit adds a build option lvgl_loglevel and sets a default similar
to that of std.log.default_level so the two are aligned more or less.
1 year ago
alex 4297c139a1
ngui: port some LVGL-based UI code from C to zig
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
this commit includes lots of new code in ui/lvgl.zig and ui/widget.zig
to work with LVGL directly from zig. in fact, some C code is moved from
ui/c/ui.c to ui/xxx.zig.

in addition, a new module ui/widget.zig is where all custom UI elements
will reside. at the moment it comprises of the ported topdrop and a new
modal func. the latter is an alternative to LVGL's lv_msgbox popup.

as a practical example, the commit replaces the power off confirmation
popup with the new modal window.
1 year ago
alex c73867ea4d
ngui: get rid of the ambiguous ui header file
functions declared in ui.h were actually used by ui.c, the opposite of
what such a header is expected to contain. these functions are defined
in zig code and declarations are better off in the same ui.c file.

this is just a quick clean up before porting some C code to zig.
1 year ago
alex cb229d5a26
nd: ping ngui at start as an in-process pipe test
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
this is an attempt at identifying the underlying problem.
unclear whether this normal behaviour on a linux kernel or something to
do with zig implementation.

either way, pinging the UI makes CommReadInvalidTag error disappear on startup.

updates #16
2 years ago
alex ad8cdf727b
ngui: yield CPU during standby mode
ci/woodpecker/push/woodpecker Pipeline was successful Details
when the screen turns off, the idle loop never gave a chance CPU to
do other work and pegged at 100%. adding a short sleep each cycle
yields CPU to the OS.

closes #15
2 years ago
alex fd49235f9e
ui: implement a screen timeout after a period of user inactivity
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
passed 60 sec of no touch screen activity, daemon turns off backlight
and gui places a black "topdrop", opposite of backdrop. simply touching
the screen reactivates it immediately.

there seem to be no way to turn screen power off, so backlight plus
black topdrop is the next best.

there's no user settings to change 60 sec timeout at the moment because it
is unclear whether it's worth adding UI elements. can always do so later.

the implementation also provides means to reactivate the screen in
an event of an alert from the daemon in the future.

closes #3
2 years ago
alex 021c810dc7
ui: move all C lvgl/zig code into lvgl.zig and drv.zig
the idea is for all zig code to use C LVGL only via this
new module lvgl.zig, all display and input driver/devices is handled
by drv.zig.

this makes C/zig nicely compartmentalized in just a handful places.
2 years ago
alex 5c60b92f85
ci: run lint, tests and build for each commit
ci/woodpecker/push/woodpecker Pipeline was successful Details
the CI uses a custom image produced by tools/ci-containerfile.
see instructions in the readme.

CI logs are at https://woodpecker.qcode.ch/nakamochi/ndg
2 years ago
alex fe68ae96d6
comm: format protocol header manually and eliminate a potential footgun
the nd/ngui protocol is a simple TLV: message tag, length and
a json-encoded payload. the issue is with the (tag, length) header which
was written/read by using raw memory pointers, such as
Writer.writeStruct. in addition, tag ordinal values were auto-generated
by the compiler.

all those deficiencies may potentially lead to bugs hard to find or
serious data leaks.

serializing and deserializing the (tag, length) header manually
makes it more robust and eliminates the footgun.
2 years ago
alex ae7c3b2db8
tools: be silent when checking c code formatting
no news is good news. and either way, clang-format verbose mode is
inconsistent with zig fmt. the latter outputs only malformatted files.
2 years ago
alex 3f6c0aef44
git: add 2ecd44a7 to blame-ignore list 2 years ago
alex 2ecd44a7db
ui/c: workaround clang-format's pointer alignment in a define
it is actually multiplication, not a pointer. reads nicer this way.
2 years ago
alex 6a93ba9a30
zig: switch from stage1 to the new stage2 compiler
stage2 has been merged and set as default around end of aug 2022 in
https://github.com/ziglang/zig/pull/12368. since then the main focus has
been on this new stage2 compiler.

with the release of 0.10.1 the stage2 is fairly useable now and it is
the way forward, towards zig 0.11 or 1.0. read more about difference in
https://github.com/ziglang/zig/wiki/Self-Hosted-Compiler-Upgrade-Guide

another good read on the relevant topic is
https://ziglang.org/news/goodbye-cpp/
2 years ago
alex c08ded524e
docs: a quick local dev setup and contributing sections
while there, made test filter actually work with

    zig build test -Dtest-filter=xxx

a previous invocation with `--test-filter` never worked.
2 years ago
alex 698e5b6f76
src,lib: zig fmt and clang-format all code
C style is now fixed by .clang-format.
a handy script to check all source code formatting is in
tools/fmt-check.sh.
2 years ago
alex 161a2b965b
license: add qeles AG to copyright holders
qeles AG is now a significant contributor, too.
https://qeles.ch
2 years ago
alex 5332d00290 ngui: make it work with zig release v0.10.0
only one tiny change: @maximum -> @max.
nothing to do for nd.
2 years ago
alex 7226c31dfb nd: increase services stop timeout to 10min but in parallel
10min looks quite excessive but based on conversations in
https://github.com/bitcoin/bitcoin/commit/7fb7acfc, better safe than
sorry. same for lnd. in any case, 30sec was indeed far too short to
begin with, especially for bitcoind.

services are now stopped in parallel, though. so, the poweroff sequence
goes faster.
2 years ago
alex 0266125c65 ui: increase default font from 14px to 16px for readability
16px looks easier to read but IPv6 addresses don't fit in the wifi
settings panel anymore. need to find a better way how to display them or
change font.
2 years ago
alex bfc71fec92 start: initial minimal implementation
3 tabs: bitcoin, lightning and settings.
only settings is populated, with wifi info and shutdown.

see build.zig for how everything ties up together.
2 years ago
alex 68dd23525e lib: add lv_drivers v8.3.0 as a subtree module
git subtree add --prefix=lib/lv_drivers --squash \
      https://github.com/lvgl/lv_drivers v8.3.0
2 years ago
alex 8e64914235 Squashed 'lib/lv_drivers/' content from commit 71830257
git-subtree-dir: lib/lv_drivers
git-subtree-split: 71830257710f430b6d8d1c324f89f2eab52488f1
2 years ago
alex 072a4a96a7 lib: add lvgl v8.3.1 as a subtree module
git subtree add --prefix=lib/lvgl --squash \
        https://github.com/lvgl/lvgl v8.3.1
2 years ago
alex 38088b9d3b Squashed 'lib/lvgl/' content from commit 9024b72b
git-subtree-dir: lib/lvgl
git-subtree-split: 9024b72b4853e1e7ac29a42e54b7a10d3c4f3b20
2 years ago
alex 6d4c4fa4b2 repo: initial blank import of zig init-exe
this is to make a valid HEAD for upcoming "git subtree add ..."
2 years ago