Skip to content

Add SDL2-native C tools menu app for R36S - #1

Open
RedMist20 wants to merge 1 commit into
mainfrom
codex/create-sdl2-gui-program-from-tools-menu.sh
Open

Add SDL2-native C tools menu app for R36S#1
RedMist20 wants to merge 1 commit into
mainfrom
codex/create-sdl2-gui-program-from-tools-menu.sh

Conversation

@RedMist20

Copy link
Copy Markdown
Owner

Motivation

  • Replace the dialog-based Tools Menu.sh with a native SDL2 GUI that better fits the R36S device and provides a cleaner user experience.
  • Provide D-pad / joystick/button navigation and an in-app terminal output panel so users can run and inspect the same safe network/driver commands without leaving the GUI.
  • Support numeric prompts (channel / txpower) inside the application and provide an explicit exit back to the terminal.

Description

  • Add cprog/tools-menu-sdl2/tools-menu-sdl2.c, a full-screen (640×480) SDL2 + SDL_ttf C program implementing the original shell menu items, command templates, and an in-app terminal output panel that captures command output.
  • Implement command execution by writing a temporary shell script and streaming its output back via popen into a scrollable right-hand “Terminal Output” pane using run_script_to_output / run_action.
  • Add joystick / D-pad mapping and logic for navigation, A/B/X/Y button behavior, and a numeric input overlay for actions that require numeric values.
  • Add cprog/tools-menu-sdl2/CMakeLists.txt (pkg-config for sdl2 + SDL2_ttf) and update README.md with build/run instructions and control mappings.

Testing

  • Attempted configuration and build with cmake -S cprog/tools-menu-sdl2 -B cprog/tools-menu-sdl2/build && cmake --build cprog/tools-menu-sdl2/build, which failed in this environment because the sdl2 pkg-config package was not present.
  • Ran gcc -fsyntax-only cprog/tools-menu-sdl2/tools-menu-sdl2.c, which failed due to missing SDL2 headers in the environment.
  • No further automated tests were available in this environment; runtime verification should be performed on a system with SDL2/SDL2_ttf development packages installed.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce3a62f60e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +334 to +336
int len = (int)strlen(input_value);
if (b == BTN_LEFT && input_cursor > 0) input_cursor--;
if (b == BTN_RIGHT && input_cursor < len - 1) input_cursor++;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support multi-digit entry in channel prompt

Numeric editing is fixed-length (len = strlen(input_value) with cursor bounded to len - 1), and the channel prompt initializes to a single character ("6"), so users can only cycle one digit (0–9). This makes it impossible to set common multi-digit channels like 36/44/149, which is a functional regression from the prior tools menu behavior.

Useful? React with 👍 / 👎.

if (e.type == SDL_QUIT) running = false;
if (e.type == SDL_KEYDOWN) {
SDL_Keycode k = e.key.keysym.sym;
if (!input_mode) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle keyboard input while numeric overlay is active

Keyboard handling is entirely skipped when input_mode is true, so if a user opens a numeric action via keyboard (Enter), they cannot edit digits, confirm, or cancel from the keyboard. On setups without a joystick (such as desktop environments used for local testing), choosing channel/txpower input leaves the app effectively stuck until the window is closed.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant