Skip to content

Conversation

@Scavanger
Copy link
Contributor

@Scavanger Scavanger commented Dec 1, 2025

*** Work in Progess ***

Preview, only partially working now: https://scavanger.github.io/inav-configurator

Working:

  • In principle, runs on the web (HTML/CSS/assets/...)
  • Flashing via DFU
  • MSP connection via WebSerial
  • Some tabs are working

To do:

Not working, :
- SITL (and probably won't) Webasssembly/emscripten version already in development

  • TCP/UDP
    TCP would be possible via WebSockets, but somehow it doesn't connect properly with SITL. INAV SITL says it's connected, but web serial remains stuck on ‘connecting’. Bug in INAV, TCP handshake problem?
    -> No, Websocket ist just raw data wrapped in a HTTP request. Emscripten has a warpper to emulate RAW TCP Sockets, but iits very unreliable and slow.
    Solution:
  • Demo mode: Just use function calls to exchange data.
  • SITL
    • RealFlight: No Problem to send/retrieve Data via REST
    • XPLane: XPLane 11 has no websocket/http server -> HITL Plugin has to be adjusted

Things to consider:

  • The CORS policy is causing problems with the firmware flasher. I have now solved this by using a proxy on a Cloudflare worker, which allows the app to download the assets.
    Any other suggestions?
  • Where should all this be hosted later? Just on GitHub pages? => Deploy pipeline?

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Branch Targeting Suggestion

You've targeted the master branch with this PR. Please consider if a version branch might be more appropriate:

  • maintenance-9.x - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release.

  • maintenance-10.x - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x

If master is the correct target for this change, no action is needed.


This is an automated suggestion to help route contributions to the appropriate branch.

@sensei-hacker
Copy link
Member

sensei-hacker commented Dec 2, 2025

The CORS policy is causing problems with the firmware flasher. I have now solved this by using a proxy on a Cloudflare worker, which allows the app to download the assets. Any other suggestions?

$ curl -I https://github.com/iNavFlight/inav/releases/download/9.1.0/inav_9.1.0_MATEKF405.hex | grep -i Access
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     9    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  
$ curl -I https://raw.githubusercontent.com/iNavFlight/inav/master/README.md 2>&1 | grep -i Access
*access-control-allow-origin: **

Scavanger#3

@sensei-hacker
Copy link
Member

sensei-hacker commented Dec 2, 2025

TCP would be possible via WebSockets, but somehow it doesn't connect properly with SITL.

I think websockets wrap it in HTTP requests. They aren't raw sockets, as I understand it.

Both Electron and PWA support web sockets, though. So one solution would be something along these lines, roughly:
sensei-hacker/inav_unofficial_targets#42

BUUUUT I have another idea in mind I'm going to try.

Lemontree-Softworks and others added 15 commits December 2, 2025 09:15
This commit fixes issues in the transpiler API definitions where
the configurator did not match the actual INAV firmware implementation.

Issues Fixed:

1. waypoint.js (CRITICAL):
   - Fixed wrong operand type (was 5/GVAR, now 7/WAYPOINTS)
   - Removed 6 fabricated properties not in firmware (latitude, longitude,
     altitude, bearing, missionReached, missionValid)
   - Added 14 actual properties from firmware (isWaypointMission, number,
     action, nextAction, distance, distanceFromPrevious, user action flags)

2. gvar.js (HIGH):
   - Fixed wrong operand type (was 3/FLIGHT_MODE, now 5/GVAR)
   - Fixed wrong operation (was 19/GVAR_INC, now 18/GVAR_SET)

3. pid.js (MAJOR):
   - Removed fabricated properties not in firmware (setpoint, measurement,
     P/I/D/FF gains, enabled)
   - Kept only 'output' property which is actually exposed (operands 0-3)
   - Changed from i*10+0..7 mapping to direct i mapping

4. flight.js (MEDIUM):
   - Added missing wind parameters 46-49:
     minGroundSpeed, horizontalWindSpeed, windDirection, relativeWindOffset

5. inav_constants.js (MEDIUM):
   - Added missing FLIGHT_PARAM constants 46-49
   - Added missing OPERATION constant 56 (OVERRIDE_MIN_GROUND_SPEED)

6. codegen.js (LOW):
   - Fixed RC channel regex to support both rc[N] and rc[N].value syntax

Testing:
- Added 5 comprehensive test files (test_rc_channels, test_gvar, test_pid,
  test_waypoint, test_flight)
- All fixes verified against firmware source code:
  - src/main/programming/logic_condition.h
  - src/main/programming/logic_condition.c
  - src/main/programming/global_variables.h
  - src/main/programming/pid.h

Files verified correct (no changes needed):
- override.js (all 10 operations match firmware)
- rc.js (correctly handled by codegen)

Documentation:
- API_BUGS_FOUND.md: Initial issue analysis
- VERIFICATION_SUMMARY.md: Complete verification findings
- FIXES_COMPLETE.md: Final fix summary with cross-references

Breaking Changes:
- pid[N].configure(), pid[N].setpoint, pid[N].enabled no longer available
  (these never existed in firmware, only pid[N].output works)
- waypoint.latitude/longitude/altitude/bearing no longer available
  (these are not exposed through logic condition system)

Firmware References:
- logic_condition.h lines 92-102 (operand types)
- logic_condition.h lines 104-155 (flight parameters)
- logic_condition.h lines 177-192 (waypoint parameters)
- logic_condition.c lines 575-669 (waypoint implementation)
- logic_condition.c lines 1078-1082 (PID implementation)
Lemontree-Softworks and others added 27 commits December 3, 2025 14:26
This commit fixes issues in the transpiler API definitions where
the configurator did not match the actual INAV firmware implementation.

Issues Fixed:

1. waypoint.js (CRITICAL):
   - Fixed wrong operand type (was 5/GVAR, now 7/WAYPOINTS)
   - Removed 6 fabricated properties not in firmware (latitude, longitude,
     altitude, bearing, missionReached, missionValid)
   - Added 14 actual properties from firmware (isWaypointMission, number,
     action, nextAction, distance, distanceFromPrevious, user action flags)

2. gvar.js (HIGH):
   - Fixed wrong operand type (was 3/FLIGHT_MODE, now 5/GVAR)
   - Fixed wrong operation (was 19/GVAR_INC, now 18/GVAR_SET)

3. pid.js (MAJOR):
   - Removed fabricated properties not in firmware (setpoint, measurement,
     P/I/D/FF gains, enabled)
   - Kept only 'output' property which is actually exposed (operands 0-3)
   - Changed from i*10+0..7 mapping to direct i mapping

4. flight.js (MEDIUM):
   - Added missing wind parameters 46-49:
     minGroundSpeed, horizontalWindSpeed, windDirection, relativeWindOffset

5. inav_constants.js (MEDIUM):
   - Added missing FLIGHT_PARAM constants 46-49
   - Added missing OPERATION constant 56 (OVERRIDE_MIN_GROUND_SPEED)

6. codegen.js (LOW):
   - Fixed RC channel regex to support both rc[N] and rc[N].value syntax

Testing:
- Added 5 comprehensive test files (test_rc_channels, test_gvar, test_pid,
  test_waypoint, test_flight)
- All fixes verified against firmware source code:
  - src/main/programming/logic_condition.h
  - src/main/programming/logic_condition.c
  - src/main/programming/global_variables.h
  - src/main/programming/pid.h

Files verified correct (no changes needed):
- override.js (all 10 operations match firmware)
- rc.js (correctly handled by codegen)

Documentation:
- API_BUGS_FOUND.md: Initial issue analysis
- VERIFICATION_SUMMARY.md: Complete verification findings
- FIXES_COMPLETE.md: Final fix summary with cross-references

Breaking Changes:
- pid[N].configure(), pid[N].setpoint, pid[N].enabled no longer available
  (these never existed in firmware, only pid[N].output works)
- waypoint.latitude/longitude/altitude/bearing no longer available
  (these are not exposed through logic condition system)

Firmware References:
- logic_condition.h lines 92-102 (operand types)
- logic_condition.h lines 104-155 (flight parameters)
- logic_condition.h lines 177-192 (waypoint parameters)
- logic_condition.c lines 575-669 (waypoint implementation)
- logic_condition.c lines 1078-1082 (PID implementation)
Updated test documentation to reflect fixed state and improve code quality:

1. test_flight.js:
   - Removed outdated 'KNOWN ISSUE' header (params 46-49 are now present)
   - Updated to use FLIGHT_PARAM_NAMES constant instead of Object.keys().find()
   - Cleaner and more performant parameter name lookup

2. test_pid.js:
   - Replaced 'KNOWN BUG TO DETECT' with 'FIRMWARE DESIGN' explanation
   - Clarified that firmware intentionally exposes only PID outputs
   - Removed 'bug' language as this is intentional firmware design

These changes address feedback from PR review bot.
Removed gvar.js and override.js as they are not used by the transpiler.

Analysis shows:
- gvar.js: Completely bypassed by hardcoded gvar handling in codegen.js
  (lines 598-610) and action_generator.js (lines 98, 108, 118, 133, 141)
- override.js: Bypassed by hardcoded operation mapping in codegen.js
  (lines 705-719)

Both files contained only documentation that duplicated information already
hardcoded in the transpiler implementation. Removing them reduces maintenance
burden and eliminates confusion from misleading values (gvar.js had wrong
type and operation values that were never actually used).

Files modified:
- Deleted: js/transpiler/api/definitions/gvar.js
- Deleted: js/transpiler/api/definitions/override.js
- Updated: js/transpiler/api/definitions/index.js (removed imports/exports)
The previous commit removed override.js but forgot to update the import
statement in js/transpiler/index.js, causing build failures:
  "Could not resolve ./api/definitions/override.js"

Changes:
- Removed import of overrideDefinitions from index.js (line 23)
- Removed overrideDefinitions from export list (line 40)

Build verified successful with npm run make.
…ividual objects

- Updated all tabs to replace the global TABS object with individual tab objects (e.g., loggingTab, magnetometerTab, etc.).
- Changed the way active tabs are set by comparing against the tab object instead of string literals.
- Exported each tab object for better modularity and maintainability.
- Ensured all tab initialization and cleanup functions are correctly referenced to their respective objects.

This should help to optimise the tabs and prevent some of the tabs from loading incorrectly in PWA.
@sensei-hacker
Copy link
Member

Have you seen https://www.inav-config.online/ ?

@Phil-MC
Copy link

Phil-MC commented Jan 2, 2026

Could you please add a note to the public view of the online configurator at https://www.inav-config.online/ , if that is yours, telling users who happen to find it that it is under development. A user reported that he had used it.

@Scavanger
Copy link
Contributor Author

To be honest, I don't think it's a good idea to just put the unfinished version online. If you want to test it, you can find the GH pages version in my repo.

By the way, more will follow soon. I still have something else to finish (info coming soon).
INAV as Webassembly is already running (demo mode), and it looks like there is also full SITL simulator 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

Successfully merging this pull request may close these issues.

4 participants