ci/woodpecker/push/woodpecker Pipeline was successfulDetails
the change is based on the previously added ini parser.
this makes lnd config gen more robust and allows to presist config
modifications in the future, such as changing node alias.
will be used to parse lnd and bitcoind config files.
git subtree add --prefix=lib/ini --squash \
https://github.com/ziglibs/ini \
2b11e8fef86d0eefb225156e695be1c1d5c35cbc
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
the daemon can now identify which state lnd is in and report to the GUI
which displays different elements on the lighting tab, based on the
reported lnd state:
- startup in progress: displays spinner
- no lightning wallet: displays a "setup" button and guides the user
through a simple workflow
- reset an operational node
this means, the UI has now minimal but functional elements for any user
equipped with a smart phone to set up the lightning node without SSHing
in or using command line in general.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
the daemon now pretends the report is sent over to ngui on such errors.
this is a stop-gap to avoid writing errors on tty. see linked issue.
part of #30
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
the "bitcoin" name is overloaded: everything's about bitcoin here.
a less confusing name is onchain to emphasize the difference w.r.t.
lightning or any other future L2 networks.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
the offending memleak printed out at program exit was introduced in
116fb3b5, specifically line 140 in src/bitcoindrpc.zig using incorrect
allocator.
while there, improved a bit overall memory handling by making sure
heap-alloc'ed messages are always deinit'ed.
another source of trouble was logging from within a sighandler: the
logger uses a thread mutex which may deadlock when the handler is
invoked by the OS.
some cards will need to show a nondeterministic progress.
the spinner in the top right corner does exactly that, controlled
via the new spin function.
the default is no spinner.
this builds on top of the main read and write fn, setting up a global
structure to allow module users imply comm.pipeWrite(msg)
and comm.pipeRead() without providing an allocator or reader/writer
on each call.
the advantage is simplification in the gui functions because they don't
have access to an allocator or the nd process read/write pipe.
disadvantage is in testing because it requires a global,
"before all tests" setup.
at the moment, only ngui is modified to use the new pipeRead/Write. the
daemon would suffer too many changes, especially in tests, due to the
global state.
funding_expiry_blocks is present in lightning.proto but a REST API call
shows no such field, at least in lnd v0.16.4, leading to json parsing error.
the field is unused at the moment anyway.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
a previous commit added some lightning tab implementation which
including balance details but only for lightning channels.
this commit queries lnd for a wallet balance and displays it on the
bitcoin tab since "wallet" funds are on-chain and it doesn't feel like
it belongs to the lightning tab in the UI.
while there, also improved some daemon backend code style, alightning
with the lightning implementation structures.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
similarly to 0260d477, the lightning tab has now some basic info
including channels list.
the gui playground is updated to send some stub data via comms
periodically.
similarly to 2642a554, this adds an lnd HTTP client able to make some
queries like getinfo. the daemon then uses the client to compose a
lightning status report and sends it over to ngui through comms,
periodically.
there's also a client playground built on demand with
"zig build lndhc".
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
while there's lots of changes and new features in zig v0.11.0, the most
important for this project at the moment is the HTTP client.
the client is most likely what will connect to lnd lightning node to
fetch stats and info for the UI to then visualize it on "lightning" tab,
similar to the bitcoind RPC client.
see all zig 0.11 release notes here:
https://ziglang.org/download/0.11.0/release-notes.html
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
a previous commit a06a4757 stopped updating the UI while in standby
mode. unfortunately, this makes the UI data become stale on wakeup.
for example, bitcoin chain height and its timestamp.
this commit keeps the last report received from daemon comm during
standby and uses it to update the UI immediately on wakeup.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
the screen.sleep fn was actually called in concurrent-unsafe mode,
i.e without acquiring UI mutex. in conjuction with commThreadLoopCycle
this would have eventually led to LVGL primitives concurrent access.
so, screen.sleep now takes UI mutex to hold during LVGL calls.
a bit ugly but certainly better than relying on luck.
the bitcoin tab has now some basic status and stats: parts of blockchain
info, network info and mempool. this is far from complete but makes a
good start for an initial version.
the gui playground is also updated to sent some stub info via comms
periodically.
this adds a very simple bitcoind RPC client able to make a few queries
like the blockchain and network status. the daemon uses the client
to get the bitcoind status and sends a report through comms periodically.
there's also a little playground program which simply dumps a query
result to stderr. built on demand with "zig build btcrpc".
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
a previous commit 7d1ab5cb rewrote toplayer objects creation as
Container.newTop except the new code was using the top layer object
obtained from lv_disp_get_layer_top as is. this obviously led to all
sorts of UB and illegal memory access when screen.sleep'ing.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
this commit improves on the LVGL API wrapping interface in zig by
defining different types where each is associated with either a
particular lv_xxx_t object in C or a logically different UI element.
this makes programming much more pleasant, allows compartmentalizing
different UI concepts and elements, and reduces chances of making a
thanks to stricter type enforcement.
no visual changes in the UI.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
fullscreen modal dialog was added in 4297c139. the callback function to
that modal *must* be aligned according to the target architecture.
failing to do so may result in "incorrect alignment" panic.
this somehow worked in 4297c139 but sometimes panic. i suspect this may
be due to PIE-enabled build, possibly in conjuction with some zig v0.10
compiler bugs.
ref #20
ref #5
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
most troubles were due to blocking nature of child process pipe
descriptions which made comm.read loops hang in various places
under certain conditions.
this commit moves all read/writes in separate threads to be able to
always watch for sig TERM and INT, and ensures child process pipes
are closed early allowing comm.read loops to terminate.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
this greatly improves UX during shutdown: no need to guess at which
point it's ok to unplug the power cord.
the commit also includes a GUI playground. a sort of a fake daemon which
sends hardcoded messages to ngui. useful for manual debugging and trying
different UX scenarious.
the daemon now sends info about the system shutdown progress: a list of
important services which may require up to several minutes to stop such
as lnd lightning daemon and bitcoin core.
see next commit for how this info is displayed and used by the GUI.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
this hides all LVGL info messages about UI interactions like events,
making the log output more useful during development.
it is still possible to increase verbosity to the original level using
the lvgl_loglevel build flag.
both nd and ngui now acquire semantic versioning recorded at the build
time. they also report the version at startup and -v flag.
this is useful for a release process and to avoid potential
compatibility issues in the future.
in a regular build flow, the version is taken from a git tag using the
following command:
git -C . describe --match 'v*.*.*' --tags --abbrev=8
in a non-standard scenario where git isn't available, the version can
be provided on the command line during build like so:
zig build -Dversion=1.2.3
if both git and command line supplied versions are available, they must
match.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
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.
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.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
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
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
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
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
ci/woodpecker/tag/woodpecker Pipeline was successfulDetails
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
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.
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.