pr3y / Bruce

Firmware for m5stack Cardputer, StickC and ESP32
GNU Affero General Public License v3.0
280 stars 48 forks source link

add CLI interface over serial, screensaver and keyboard shortcuts #64

Closed eadmaster closed 1 month ago

eadmaster commented 1 month ago

cloning FlipperZero CLI, allow to quickly send cmds over serial.

e.g.

ir tx NEC 04000000 08000000

Currently WIP in my forked repo.

use cases:

EDIT: just realised this needs -DARDUINO_USB_CDC_ON_BOOT=1 added to the platformio build flags to work correctly on the Cardputer.

eadmaster commented 1 month ago

while checking the existing code i've also noticed the current tv-b-gone code is not using the correct function args

  void sendNEC(uint64_t data, uint16_t nbits = kNECBits,
               uint16_t repeat = kNoRepeat);
eadmaster commented 1 month ago

UPDATE:

other issues i've found:

eadmaster commented 1 month ago

UPDATE: added some audio-related commands via the ESP8266Audio library just for fun:

These could go in a new "Audio" menu in the future.

eadmaster commented 1 month ago

Another push adding a much needed "screensaver" feature:

corresponding serial commands are:

TODO for this:

eadmaster commented 1 month ago

another usability feature: added keyboard shortcuts to quickly access apps from the main menu. Only 3 are hard-coded atm:

Obliviously these works only on the Cardputer.

Added another serial command: clock (just show a big clock).

eadmaster commented 1 month ago

EDIT: just realised this needs -DARDUINO_USB_CDC_ON_BOOT=1 added to the platformio build flags to work correctly on the Cardputer.

just tested badusb, it is working correctly with this flag turned on, so i am adding another shortcut for it:

eadmaster commented 1 month ago

just noticed the serial cmds are not processed when you are in any submenu, but they are kept in the buffer and only processed when you go back to the main menu.

I may add a task to have async execution, but this could led to other issues due to concurrent access to global resources, so my first PR for this will only include sync command processing. (tldr: it only works when you are in the main menu)

eadmaster commented 1 month ago

I may add a task to have async execution, but this could led to other issues due to concurrent access to global resources

I've tried this without setting any mutexes and it seems to be working correctly, not sure if it is actually a good idea to have in the mainline.

example use cases: send IR/RF commands while running the captive portal, listen an audio file while navigating the UI, etc.

eadmaster commented 1 month ago

Closing this as the base feature was merged, currently adding more cmds here: https://github.com/pr3y/Bruce/issues/107