Skip to content

Add gsmenu #62

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

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open

Add gsmenu #62

wants to merge 55 commits into from

Conversation

henkwiedig
Copy link
Collaborator

@henkwiedig henkwiedig commented Apr 4, 2025

gsmenu
This merge request adds a menu to PixelPilot_rk.
The menu provides options to modify air and ground settings.
Navigation is controlled via a GPIO button, adhering to Ruby wiring conventions.
PixelPilot_rk will take ownership of the needed gpios.

Menu Navigation

Up/Down – Cycles through menu items (wraps around at the top and bottom of the page/sections).
Left/Right/Ok (Back/Menu/QA1 in Ruby terms) – Adjusts selected values.
Ok becomes Rec/QA1 when menu is not shown.
When not in menu any navigation key will open the menu.

Implementation Details

The actual logic for getting/setting values and their ranges is handled by the gsmenu.sh script.
Ensure the script is in your PATH (e.g., /usr/local/bin or /usr/bin).

Restart Functionality

The menu includes an option to restart PixelPilot_rk. For this to work, the startup script/service must handle the following exit codes:

1 – User requested restart.
2 – No restart requested.
Other – Unexpected termination (suggest restart).

Fixes

Resolves #15 – Adds the ability to exit PixelPilot from the menu.

Copy link
Contributor

@zhouruixi zhouruixi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion stage 1

gsmenu.sh Outdated
echo -e "1\n20\n25\n30\n35\n40\n45\n50\n55\n58"
;;
"values air wfbng air_channel")
iw list | grep MHz | grep -v disabled | grep -v "radar detection" | grep \* | tr -d '[]' | awk '{print $4 " (" $2 " " $3 ")"}' | grep '^[1-9]' | sort -n | uniq
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for | grep -v "radar detection"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally left out the "radar detection" channels because they might cause interference, and wfg-ng does not support radar detection. Novice users may not be aware of such issues, so this makes the tool more reliable for them.
We already have 25 5GHz channels to choose from, so there’s no need to add more that could lead to a poor experience.
What do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the user should be able to choose which channel to use. If you can set the DFS channel manually but the gsmenu can't, it will cause confusion. In addition, most areas probably don't have radar.

then
sed -i 's/^render =.*/render = air/' /config/scripts/osd
killall msposd_rockchip
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not enable msposd ExternalSurfaceWidget in pp_rk's osd config file, enable gs rendering will always Shared memory 'msposd' does not exist. Waiting... and cause gsmenu Segmentation fault. Add [ ! -e /dev/shm/msposd ] && exit 1 to return error when msposd ExternalSurfaceWidget is not enabled.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give more details ? I can not reproduce this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give more details ? I can not reproduce this.

  1. Run pixelpilot --osd in the foreground
  2. Enable msposd gs_rendering in pp_rk menu
  3. Get segmentation fault
    image

@zhouruixi
Copy link
Contributor

zhouruixi commented Apr 8, 2025

Bugs:

  • click restart pixelpilot seems just exit not restart.
  • If the drone can not be connected, modifying drone settings (such as fec_n) will cause gsmenu to be unable to perform any operations.

@zhouruixi
Copy link
Contributor

zhouruixi commented Apr 8, 2025

Suggestions optimize button operation logic.

  • Scroll selection while holding button(Now only can short pressing to select one by one)
  • Long press back button to exit gsmenu in any where(Now have to locate the exit icon and press OK to proceed)
  • Always and only use up/down to select options or increase/decrease values(Now up/right, down/left can all be used to select or increase values.)
  • Use left for back/cancel and use right for enter/confirm settings. For example, Once I enter screen_mode select menu, must have to select an option(or blank) and press OK to back, which is very troublesome.
  • Apply the configuration when exiting the value setting. For example, if I changing drone wfb fec settings, adjust fec_n from 12 to 16, every time I press the button, the value will increase by 1 and the command will be executed once. I think this would be better: Use up/down to locate fec_n, press right or ok to enter the settings, fec_n background is highlighted, press up/down to increase or decrease the value, press right or ok to apply the setting and back, press left to cancel the setting and back.
  • As mentioned above, right can completely act as OK, we only need four buttons to complete everything

@henkwiedig
Copy link
Collaborator Author

henkwiedig commented Apr 9, 2025

Bugs:

  • click restart pixelpilot seems just exit not restart.
  • If the drone can not be connected, modifying drone settings (such as fec_n) will cause gsmenu to be unable to perform any operations.
  1. pixelpilot restart has to be handled by the start script or systemd service which starts it. The Exit/Restart button just change the exit code of PP, see PR description.
  2. I changed the error handleing, can you try if you can reproduce the "hang" scenario ?

@henkwiedig
Copy link
Collaborator Author

henkwiedig commented Apr 10, 2025

Suggestions optimize button operation logic.

  • Scroll selection while holding button(Now only can short pressing to select one by one)
  • Long press back button to exit gsmenu in any where(Now have to locate the exit icon and press OK to proceed)
  • Always and only use up/down to select options or increase/decrease values(Now up/right, down/left can all be used to select or increase values.)
  • Use left for back/cancel and use right for enter/confirm settings. For example, Once I enter screen_mode select menu, must have to select an option(or blank) and press OK to back, which is very troublesome.
  • Apply the configuration when exiting the value setting. For example, if I changing drone wfb fec settings, adjust fec_n from 12 to 16, every time I press the button, the value will increase by 1 and the command will be executed once. I think this would be better: Use up/down to locate fec_n, press right or ok to enter the settings, fec_n background is highlighted, press up/down to increase or decrease the value, press right or ok to apply the setting and back, press left to cancel the setting and back.
  • As mentioned above, right can completely act as OK, we only need four buttons to complete everything

I changed the navigation to a 4 button only version. Please give it a try.
Feels naturally for dropdowns.
On sliders you will have to first "enter the slider" then changeing the value useing up/down. Then either commit current value (right) or cancel (left) just like dropdowns.
Slider are applied in commit only.

Edit:
also key repeats are now possible

still working on the back button handleing

Edit 2:
For the keybaord there is currently no option but to use 5 keys (OK/QA1) besides long press to hit the key. Dont know if thats desireable.

@zhouruixi
Copy link
Contributor

zhouruixi commented Apr 11, 2025

Bugs:

  1. By default, the /root/.ssh folder does not exist, which results in an error message for -o ControlPath=~/.ssh/control:%h:%p:%r. Consider changing it to -o ControlPath=/run/ssh:%h:%p:%r?
  2. After exiting gsmenu and re-entering gsmenu, will show the submenu before exit, bu the submenu will not refresh automatically. I need to switch to another submenu and re-enter to refresh. Should show the initial default menu instead of the submenu before exit it? And the default menu can display some current information, such as channel, screem_mode, remaining space, remaining memory, CPU temperature and other key information

The user experience has been greatly improved compared to before, but there are still optimization suggestions:

  1. I think Up/down should only cycles within a specific level or drop-down menu, for example, the leftmost drone and GS settings is the first level menu, and GS System settings is the second level menu. Press right to enter the next level menu, press left to return to the previous level menu. In addition, I think the exit icon < OpenIPC can be replaced with Exit gsmenu and placed at the bottom, As an option in the first level menu, this is more intuitive and easy to use
  2. When you press the up button continuously to reach the top of the menu, continue to press the up button to jump to the bottom and start the cycle. When you press the down button continuously to reach the bottom of the menu, continue to press the down button to jump to the top and start the cycle
  3. Customized GPIO for buttons is necessary. There are more and more options for pp_rk. May can consider having it's own configuration file, can run pp_rk using parameters from the command line or run it using the configuration file
  4. Can add some transparency to gsmenu?
  5. Imagine, just see: Is it possible to provide an interactive method to use other programs to simulate button behavior without physical buttons? In this way, we can easily use the keyboard or webui
  6. I think should get the drone configuration file once and then parse it, instead of getting one configuration item at a time, which will greatly improve the configuration loading speed. Of course, this can be optimized later.

I'm testing with my own image instead of the stock SBC image and can't test it fully, so we need more testers. Thanks again for your great work!

@henkwiedig
Copy link
Collaborator Author

henkwiedig commented Apr 12, 2025

Bugs:

  1. By default, the /root/.ssh folder does not exist, which results in an error message for -o ControlPath=~/.ssh/control:%h:%p:%r. Consider changing it to -o ControlPath=/run/ssh:%h:%p:%r?
  2. After exiting gsmenu and re-entering gsmenu, will show the submenu before exit, bu the submenu will not refresh automatically. I need to switch to another submenu and re-enter to refresh. Should show the initial default menu instead of the submenu before exit it? And the default menu can display some current information, such as channel, screem_mode, remaining space, remaining memory, CPU temperature and other key information

Should be fixed now.

  1. I think Up/down should only cycles within a specific level or drop-down menu, for example, the leftmost drone and GS settings is the first level menu, and GS System settings is the second level menu. Press right to enter the next level menu, press left to return to the previous level menu. In addition, I think the exit icon < OpenIPC can be replaced with Exit gsmenu and placed at the bottom, As an option in the first level menu, this is more intuitive and easy to use
  2. When you press the up button continuously to reach the top of the menu, continue to press the up button to jump to the bottom and start the cycle. When you press the down button continuously to reach the bottom of the menu, continue to press the down button to jump to the top and start the cycle

Cycling now is only done on the menu page level, you can go back useing the back button.
Back does not work when currently positioned on a switch, i opened an issue for that at the lvgl project.
Still working on the back button to close the menu itself.

  1. Customized GPIO for buttons is necessary. There are more and more options for pp_rk. May can consider having it's own configuration file, can run pp_rk using parameters from the command line or run it using the configuration file

Will come later, i am currently focusing oon gettting something working for the Runcam VRX.

  1. Can add some transparency to gsmenu?

Tried that but found that needs recoloring all widgets.Guess i will add it to the "later" todo list ;)

  1. Imagine, just see: Is it possible to provide an interactive method to use other programs to simulate button behavior without physical buttons? In this way, we can easily use the keyboard or webui

You can use PP_rk useing "w,a,s,d,Enter" keys when started from console. It that what you mean ?

  1. I think should get the drone configuration file once and then parse it, instead of getting one configuration item at a time, which will greatly improve the configuration loading speed. Of course, this can be optimized later.

Correct, this will then also need some "cache refresh" logic. Grek also has some manual alink settings app that would greatly improve the speed.
For the time beeing i would like to focus on bugs first. Then improve from there once we get this shipped to devices.

@henkwiedig
Copy link
Collaborator Author

I now completely removed the back button (in ui only). Closeing the menu works using back.

@zhouruixi
Copy link
Contributor

zhouruixi commented Apr 14, 2025

small bug:

  1. When in the first level menu, pressing left should exit gsmenu directly, but it will actually execute the following command before exiting
Running command: gsmenu.sh get gs main Version
Running command: gsmenu.sh get gs main Disk
Running command: gsmenu.sh get gs main WFB_NICS
Running command: gsmenu.sh get gs main Channel
Running command: gsmenu.sh get gs main HDMI-OUT
  1. In drone wfb-ng settings, the background frame at the bottom(a-link enabled) is not fully displayed

You can use PP_rk useing "w,a,s,d,Enter" keys when started from console. It that what you mean ?

There are many kinds of input devices, such as keyboards, joystick, Bluetooth remote controls, web buttons, etc. It is impossible for pp_rk to support all input devices. Can pp_rk provide something like an API so that external programs can simulate GPIO buttons through the API to operate pp_rk gsmenu? This can keep pp_rk simple and allow pp_rk to support a variety of input devices by external programs. Like MPV's Key bindings and JSON IPC, This is just a discussion, not a high priority.


In addition, I think a tag should be added before gsmenu is merged

@zhouruixi
Copy link
Contributor

zhouruixi commented Apr 23, 2025

bugs:

  1. gsmenu sometimes hangs("text" is displayed on screen, and the circle behind it keeps rotating) and can't exit when gsmenu.sh command returns 1, For example, execute wfb-ng search in gsmenu.
  2. After entering gsmenu, DroneSettings-WFB-NG is highlighted, showing some GS information. There should be a dedicated first-level menu showing GS info, or no first-level menu is highlighted when showing GS info.
  3. drone detection is not working for me, It always shows the drone is not connected

@henkwiedig
Copy link
Collaborator Author

bugs:

  1. gsmenu sometimes hangs("text" is displayed on screen, and the circle behind it keeps rotating) and can't exit when gsmenu.sh command returns 1, For example, execute wfb-ng search in gsmenu.

I think i fixed this race now

  1. drone detection is not working for me, It always shows the drone is not connected

what version of wfb-ng are you useing ? can you update ?

@zhouruixi
Copy link
Contributor

discuss:

  1. Should the pixelpilot configuration file extension be yaml instead of yml? The advantage of doing so is that it is consistent with the official YAML documentation recommendation and the extension used by openipc.
  2. Is it better to use /etc/pixelpilot.y[a]ml or /etc/pixelpilot/pixelpilot.y[a]ml as the default path for the configuration file? The advantage of /etc/pixelpilot.y[a]ml is that it is short and concise. The advantage of /etc/pixelpilot/pixelpilot.y[a]ml is that the osd configuration files can be stored in a centralized location without cluttering the /etc directory files(I have integrated several different osd presets).
  3. Can you add a parameter to specify the configuration file path?
  4. Should ExternalSurfaceWidget be enabled or disabled by command line parameters or yaml configuration files instead of osd configuration files?

@zhouruixi
Copy link
Contributor

what version of wfb-ng are you useing ? can you update ?

works fine in the latest commit, thanks.

@henkwiedig henkwiedig force-pushed the gsmenu branch 2 times, most recently from 137d9fc to c392adb Compare May 1, 2025 13:47
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

Successfully merging this pull request may close these issues.

Add keyboard kill support
2 participants