Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eadmaster opened this issue Jul 12, 2024 · 9 comments
Closed

Comments

@eadmaster
Copy link
Contributor

eadmaster commented Jul 12, 2024

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:

  • quick debugging existing features without navigating the menus
  • remote control from a PC using a serial terminal or a python script
  • remote control from a smartphone using SerialManager

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

eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 12, 2024
@eadmaster eadmaster changed the title add CLI interface over serial add CLI interface over serial (help needed) Jul 13, 2024
@eadmaster eadmaster changed the title add CLI interface over serial (help needed) add CLI interface over serial Jul 13, 2024
@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 13, 2024

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 added a commit to eadmaster/Bruce that referenced this issue Jul 16, 2024
@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 16, 2024

UPDATE:

  • code conversion from the flipper ir format now implemented correctly (only NEC protocol for now).
  • added Tasmota commands support (e.g. IRSend {"Protocol":"NEC","Bits":32,"Data":"0x20DF10EF"})
  • added command to send custom RF commands via rc-switch (tested with official RF433T module) e.g. RfSend {"Data":"0x447503","Bits":24,"Protocol":1,"Pulse":174,"Repeat":10}

other issues i've found:

  • For some reason IrTx is reset to 0 during boot, must be set manually via the config menu (quick workaround here)
  • sometimes menu navigation goes into an infinite loop after sending a command

eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 16, 2024
eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 19, 2024
@eadmaster
Copy link
Contributor Author

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

  • RTTTL player music_player mario:d=4,o=5,b=100:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6
  • audio file player from SD/LittleFS: music_player audio/1up.wav
  • text-to-speech : say hello world

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

eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 19, 2024
@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 19, 2024

Another push adding a much needed "screensaver" feature:

  • turns off the LCD after 60s of inactivity. This won't put the CPU in deepsleep mode, so any activity in progress won't be affected (incl. wifi). Press any key to wake up from sleep.

corresponding serial commands are:

  • lcd off
  • lcd on

TODO for this:

  • check if wakeup from all submenus is working correctly. May need to restart the timer while looping in some cases (example).
  • add an EEPROM setting to customize the timeout
  • add other configurable screensaver modes (e.g. a big clock)

@eadmaster eadmaster changed the title add CLI interface over serial add CLI interface over serial + other improvements Jul 21, 2024
@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 21, 2024

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

  • i -> Custom IR
  • r, s -> Custom RF/SubGhz
  • w -> Web UI

Obliviously these works only on the Cardputer.

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

eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 21, 2024
@eadmaster
Copy link
Contributor Author

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:

  • b -> bad USB

@eadmaster eadmaster changed the title add CLI interface over serial + other improvements add CLI interface over serial + screensaver and keyboard shortcuts Jul 23, 2024
@eadmaster eadmaster changed the title add CLI interface over serial + screensaver and keyboard shortcuts add CLI interface over serial, screensaver and keyboard shortcuts Jul 23, 2024
eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 25, 2024
pr3y added a commit that referenced this issue Jul 25, 2024
eadmaster added subghz submenu, keyboard shortcuts (#64)
@eadmaster
Copy link
Contributor Author

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)

pr3y added a commit that referenced this issue Jul 26, 2024
@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 26, 2024

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 added a commit to eadmaster/Bruce that referenced this issue Jul 26, 2024
pr3y added a commit that referenced this issue Jul 26, 2024
added power serial cmds, wakeup cardputer by pressing any key (#64)
@eadmaster
Copy link
Contributor Author

Closing this as the base feature was merged, currently adding more cmds here:
#107

eadmaster added a commit to eadmaster/Bruce that referenced this issue Aug 20, 2024
pr3y added a commit that referenced this issue Aug 20, 2024
headless fixes (#107), added some serial cmds (#64), initial encrypted files support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant