Commit graph

188 commits

Author SHA1 Message Date
bunnie
fda782663a bump version pins for xous change 2023-12-26 00:13:10 +08:00
bunnie
efb087c01a
Merge pull request #455 from betrusted-io/mtxchat-layout-tests
WIP: Mtxchat layout refactor
2023-12-02 16:13:04 +08:00
bunnie
fa3f349a0a bump pins as xous-rs has changed 2023-12-01 21:20:01 +08:00
bunnie
f88afd1a1a fix various edge cases; move status bar redraw to end of routine
putting the status bar redraw at the end means that even if
the fitting of the boxes isn't 100% correct, the status bar still
ends up "on top".
2023-12-01 17:55:39 +08:00
bunnie
0da86640b1 cleanup debug statement 2023-12-01 17:55:26 +08:00
bunnie
e4fba76ed2 add some debugging infos
the scroll-down freeze is actually because of the nature of
the test program hijacking the main loop. the test program
probably needs to be redesigned so it takes in events so we
don't eventually end up in deadlock
2023-12-01 03:17:00 +08:00
bunnie
157f0031e6 refactor layout to take advantage of pre-computed height bubbles
mostly works, so checkpointing it here. need to debug why going down
after going up (in terms of selection) is not working.
2023-12-01 02:23:47 +08:00
bunnie
7222fb0de9 add an optional bounding rectangle field to posts
this is computed when the post is added to the list of posts.

Also split out the visual properties of a UI into a separate
struct so that we can pass it as a single argument to routines
that could handle layout-related tasks.
2023-11-30 23:05:41 +08:00
bunnie
c5dff9d35d Merge branch 'main' of github.com:betrusted-io/xous-core into mtxchat-layout-tests 2023-11-30 18:19:20 +08:00
nworbnhoj
e8e875742e replace more TcpStream::connect(&str) with TcpStream::connect((&str, u16))
resolves #453
2023-11-30 20:29:15 +11:00
nworbnhoj
0fc9a07f5e replace TcpStream::connect(&str) with TcpStream::connect((&str, u16))
resolves #453
2023-11-30 19:41:42 +11:00
bunnie
4a5bedd6ab Merge branch 'main' of github.com:betrusted-io/xous-core into mtxchat-layout-tests 2023-11-30 14:22:15 +08:00
nworbnhoj
ffa3d56af4 fix ChatOp::PostAdd to default correctly to dialogue_key set by ChatOp::DialogueSet 2023-11-30 07:24:58 +11:00
nworbnhoj
7e485885b7 introduce tls probe help modals
- invalid certificate modal
- unknown issuer modal
- not valid yet modal
2023-11-29 16:42:21 +11:00
nworbnhoj
492d089d5c fix typos 2023-11-29 12:06:02 +11:00
bunnie
dcd8076306 pull in the comments and notes from #445 so it's in the code 2023-11-28 17:53:12 +08:00
bunnie
c2becc089b implement default behavior when no dialog is specified.
- the `post_add()` API on the 'lib' side of things says Add a new Post
  to the current `Dialogue`, and it passes an empty `dialogue_id` string.
- the `post_add()` handler on the server dutifully unpacks the `dialog_id`
  field with `post.dialogue_id.as_str().unwrap()`, and then passes on to
  the `post_add()` call inside the UI object
- the `post_add()` implementation in the UI object then checks the
  `dialog_id` with if `pddb_key.eq(&dialogue_id)`, expecting that the key
  should match the dialog id. But through this path, the dialogue ID
  is always the empty string, so the function can't work.

This patch causes the code to "fall through" and use the default
`pddb_key` if the length of the `dialog_id` is zero. Not sure if
this is the intended behavior, but in the test case at least I get
posts appearing now once this patch is in.
2023-11-28 17:24:56 +08:00
bunnie
d4624124c9
Merge pull request #443 from betrusted-io/chat-status
WIP: Chat status
2023-11-03 13:54:34 +08:00
bunnie
6ab88117f6 bump xous-api-log version & fix version pins 2023-10-31 20:07:28 +08:00
bunnie
5aefcac8ec add forced redraw function, fix misdirected message
- rapid redraws are normally aborted by this routine. offer a forced
redraw in the case that a "final state" has to be rendered without
fail.

- fix a misdirected message (sending it to app instead of to ui by
accident)
2023-10-29 23:03:46 +08:00
bunnie
d4a934785b re-introduce a default text to display when going out of busy state
this simplifies the problem of tracking concurrency if multiple threads
are requesting a busy-state to be presented. In this case, when the
final thread leaves its busy state, the idle-state will be shown.
2023-10-29 20:07:22 +08:00
bunnie
4423339059 move wifi delay hook to the correct area
- remove modal pop-up for wifi connection, and replace with
busy animation
- specify units of delay in the constants (_MS to indicate milliseconds;
this is a convention I'm trying to adhere to)
- partial progress on debugging why the animation isn't running
(value of animation variable is not being passed back at the GAM layer).

Also a general note on coding styles that probably is going to cause
confusion now that more people are contributing to the code base.

Generally, when a lot of "generic" library functions fail, we've been
passing an error message up the stack. However, these functions are
actually meant to be infalliable, and when you kick the error up the
stack you just end up with a panic at an unhelpful location (because
you finally catch the error only at the main loop or something and
by that point there's nothing you can really do about it but panic,
since it's supposed to be an infalliable operation).

As a result I have been trying to tamp down on needless error propagations
and having them fail with a unwrap or expect at the point where the
abstraction should be infalliable. This helps in debugging the actual
failure root cause because you're closer to the line of code that
actually broke, instead of just some line at a generic error handler.

Of course if you build with stack unwinding the top-level unwraps are more
useful because you can peer down into the call chain, but even then,
with the limited screen real estate I think deeply nested failures
would probably overflow any panic display. So even with panic unwinding
I think we stil want to keep the root cause within a few stack frames,
instead of errors being passed up sixteen levels of abstraction before
finally dying.

This only applies to things that are meant to be truly infalliable,
like syscalls that should not fail, or like unpacking a buffer or
memory message that has already been allocated. In this case the errors
are more like asserts, and are helpful if they fail at the line where
they break instead of being passed up the call stack (which was the
original architecture).

Probably I should add a note about this to the Xous Book.
2023-10-29 16:33:03 +08:00
bunnie
4e027b676c remove logic from status primitive and make the interface simpler
- status bar text is just status bar text now
- idle animation runs/stops based on an explicit run/stop message

Note that at the moment if one starts the busy bar and a modal pops
up, you might overflow the queue of the ui drawing thread with animation
requests, because the thread blocks when the modal is summoned.

Modals "take the screen" anyways, so maybe the solution to this is
to add an additional interlock around any modal calls within the UI
main thread. Need to think about it a bit more.
2023-10-29 01:08:38 +08:00
bunnie
d844c4306c reduce size of chat status bar to match status bars above 2023-10-28 22:50:23 +08:00
bunnie
be39c44b17 add a stand-in initial startup message
This prompts users on how to raise the menu. Not sure if it's
the right thing, but it's something.
2023-10-20 00:48:10 +08:00
bunnie
b456bfaf3b add busy-wait animation server and hooks for managing the same
Busy-wait animaitions are handled by a helper server that is normally
blocked. A single shared `bool` indicates whether the animation should
run or not.

When woken up, the busy-wait animator will check if the shared `bool`
is set, and if so, send a message to the main loop to update
the animation, then send wait an appropriate timeout and send itself
a message to re-check the animation status.

This particular format of server is fairly compact but can be vulnerable
to a "message storm" if busy state updates happen in rapid
succession without allowing the server to unblock and handle messages.
Thus, all messages to this server use a `try_send` method, with a silent
failure if the message can't be sent. In other words, if the animator
is already super busy and its queue is full, don't send it more messages,
just drop the existing updates so we can fail without a panic or deadlock.
The typical consequence of this is some UX inconsistency, which is
not a critical error.
2023-10-20 00:43:09 +08:00
bunnie
355425726d add data structures to track status bar state
- status bar gets some initial text on boot
- previous status message is saved when entering a busy state,
and restored on exit
- add routines for hopefully making the redraw a bit more efficient
if the only thing happening is a busy-wait update.
2023-10-20 00:41:19 +08:00
bunnie
8401d924e0 add opcodes for updating status bar and running busy animations 2023-10-20 00:40:26 +08:00
bunnie
d63b5912b1 absorb new xous-rs version 2023-10-10 16:50:00 +08:00
bunnie
83256257e1 bump xous-rs crate to absorb Send derives on Messages
this is necessary for the smoltcp port
2023-10-03 20:54:14 +08:00
bunnie
7e204604e9
Merge pull request #418 from nworbnhoj/chat
integrate tls trusted root_store into mtxchat
2023-09-26 11:02:18 +08:00
nworbnhoj
61c1747475 integrate tls trusted root_store into mtxchat
Set up tls with rustls::ClientConnection,
BUT - on Error::InvalidCertificate - then
probe the host for the untrusted certificate chain and prompt the user
to perhaps trust one of the certificates in the chain - then try again.
2023-09-25 11:22:47 +10:00
bunnie
e6c61455ba update PIO code for SoC integration
- add duart debug for bare iron testing
- add wait states on FIFO commits for when CPU clock is much
faster than PIO clock.

more wait states will be needed for correct operation in the
future
2023-09-22 22:19:32 +08:00
bunnie
08827633ac bring Chat dependencies up to date 2023-09-19 19:41:56 +08:00
bunnie
a00672cd27 fix missing use statements in tls lib 2023-09-19 19:39:27 +08:00
bunnie
b3e9108bb7
Merge branch 'main' into revert-414-revert-409-tls.probe 2023-09-19 19:28:30 +08:00
bunnie
9f57ad96fd
Merge pull request #408 from nworbnhoj/chat
mtxchat app and chat library
2023-09-19 19:09:56 +08:00
bunnie
c5d81ef08b
initialize menu before mounting PDDB
This is necessary because mounting the PDDB is a "secure" operation, and secure ops will fail until all UX contexts are occupied.

This problem does not manifest in hosted mode because we cheat and automount the PDDB in hosted mode.
2023-09-19 19:08:36 +08:00
nworbnhoj
7803efec7f pass room_alias aka dialogue_id aka dialogue.pddb_key to mtxchat.listen()
this ensures that new Matrix Events received from the server are added to the correct chat::Dialogue
2023-09-18 18:49:59 +10:00
bunnie
82c7b6ebed bring the versions up to date with main for a cleaner merge 2023-09-15 16:32:04 +08:00
bunnie
885e877b43 add features for mdma test to control RAM src/dest regions
The MDMA controller seems broken on the FPGA board, but is working
in RTL. Add a feature flag that allows us to toggle between modes.
2023-09-15 15:09:20 +08:00
bunnie
ab8a5aefcf fix target dependency options 2023-09-15 11:25:22 +08:00
bunnie
49eaac1b46 fix port I/O settings 2023-09-15 11:25:08 +08:00
bunnie
d47bc1af0a remove pio_generated, we should now be relying on utra 2023-09-14 16:25:14 +08:00
bunnie
2387aa4dff migrate to latest pio; tweaks to PIO tests 2023-09-14 16:24:39 +08:00
nworbnhoj
61743a9c76 mtxchat tidy-up 2023-09-14 05:30:33 +10:00
bunnie
06953cec55 remove overly sensitive test case
this case is too sensitive to clock config outside of the PIO
block, because it relies on some specificts of how inter-bus sync
works and the environment is free to set PIO and PCLK relationship
arbitrarily
2023-09-13 10:29:14 +08:00
nworbnhoj
d8db9ad2a7 fix tls::rota.public_key() 2023-09-13 07:20:10 +10:00
nworbnhoj
a06d84d8a9 convert mtxchat to use tls.root_store()
a ureq::Agent is configured to use tls.root_store(), and used for all comms with the matrix server
2023-09-13 07:18:22 +10:00
nworbnhoj
c22419f7c7 bump rustls to harmonize versions 2023-09-13 06:57:39 +10:00