diff --git a/docs/javascript_programming/OPERATIONS_REFERENCE.md b/docs/javascript_programming/OPERATIONS_REFERENCE.md index 6ad1315256b..25c7271295c 100644 --- a/docs/javascript_programming/OPERATIONS_REFERENCE.md +++ b/docs/javascript_programming/OPERATIONS_REFERENCE.md @@ -66,31 +66,31 @@ const altitudePercent = mapOutput(mapInput(inav.flight.altitude, 5000), 100); ```javascript // LOW state - RC value < 1333us -if (inav.rc[0].low) { +if (inav.rc[1].low) { // Roll stick is in low position inav.gvar[0] = 1; } // MID state - RC value between 1333-1666us -if (inav.rc[1].mid) { +if (inav.rc[2].mid) { // Pitch stick is centered inav.gvar[1] = 1; } // HIGH state - RC value > 1666us -if (inav.rc[2].high) { +if (inav.rc[3].high) { // Throttle stick is in high position inav.override.vtx.power = 4; } // Access raw RC value -if (inav.rc[3].value > 1700) { +if (inav.rc[4].value > 1700) { // Custom threshold on yaw channel inav.gvar[2] = 1; } // Combined with logical operations -if (inav.rc[0].low && inav.rc[1].mid && inav.rc[2].high) { +if (inav.rc[1].low && inav.rc[2].mid && inav.rc[3].high) { // Specific stick combination detected inav.override.armSafety = 1; } @@ -99,7 +99,7 @@ if (inav.rc[0].low && inav.rc[1].mid && inav.rc[2].high) { ## Notes -- RC channels: `rc[0]` through `rc[17]` (18 channels) +- RC channels: `rc[1]` through `rc[34]`. Channel numbers start at 1, as in the receiver tab. - RC channel properties: `.value` (1000-2000us), `.low` (<1333us), `.mid` (1333-1666us), `.high` (>1666us) - Trig functions: sin/cos/tan take degrees; acos/asin use ratios (-1..1) and atan2 returns a signed angle in (-180, 180] degrees from y/x inputs - MODULUS operator bug fixed: `%` now correctly generates MODULUS operation diff --git a/docs/javascript_programming/TESTING_GUIDE.md b/docs/javascript_programming/TESTING_GUIDE.md index c44f4ad9202..7727797c15a 100644 --- a/docs/javascript_programming/TESTING_GUIDE.md +++ b/docs/javascript_programming/TESTING_GUIDE.md @@ -141,11 +141,11 @@ Expected: Error with suggestion for correct property ### 3. Edge Cases ```javascript // Test boundary values -if (inav.rc[0].low) { // Channel 0 (first) +if (inav.rc[1].low) { // Channel 1 (first) inav.gvar[0] = 1; } -if (inav.rc[17].high) { // Channel 17 (last valid) +if (inav.rc[34].high) { // Channel 34 (last valid) inav.gvar[1] = 1; } @@ -155,7 +155,7 @@ Expected: Valid generation for both ### 4. Complex Combinations ```javascript // Test multiple operations together -if (xor(inav.rc[0].low, inav.flight.armed)) { +if (xor(inav.rc[1].low, inav.flight.armed)) { inav.gvar[0] = Math.max(100, inav.flight.altitude); } diff --git a/docs/javascript_programming/api_definitions_summary.md b/docs/javascript_programming/api_definitions_summary.md index 61f8a26d5de..dceaeefe4bc 100644 --- a/docs/javascript_programming/api_definitions_summary.md +++ b/docs/javascript_programming/api_definitions_summary.md @@ -37,7 +37,7 @@ Contains override operations: ### 3. ✅ **rc.js** - RC Receiver Channels (READ-ONLY) **Source**: RC channel handling in firmware -18 RC channels (rc[0] through rc[17]), each with: +34 RC channels (rc[1] through rc[34]), each with: - `value`: Raw channel value (1000-2000µs) - `low`: Channel < 1333µs - `mid`: Channel 1333-1666µs @@ -98,7 +98,7 @@ Combines all definitions into single object. |------|--------|-------|----------|-------| | flight.js | ✅ Ready | ~250 | FLIGHT(0-44) | All flight parameters | | override.js | ✅ Ready | ~150 | OPS(23-46) | All override operations | -| rc.js | ✅ Ready | ~80 | RC(0-17) | 18 RC channels | +| rc.js | ✅ Ready | ~80 | RC(1-34) | 34 RC channels | | gvar.js | ✅ Ready | ~30 | GVAR(0-7) | 8 global variables | | waypoint.js | ✅ Ready | ~80 | WAYPOINT(0-8) | Waypoint nav data | | pid.js | ✅ Ready | ~70 | PID(0-3) | 4 PID controllers | diff --git a/docs/javascript_programming/index.md b/docs/javascript_programming/index.md index a5a834dd83e..bd4409f0104 100644 --- a/docs/javascript_programming/index.md +++ b/docs/javascript_programming/index.md @@ -183,7 +183,7 @@ Instructions for: - `var` variables: allocated to global variables - Ternary operator: `condition ? value1 : value2` - Arrow functions: `() => condition` -- Object property access: `inav.flight.altitude`, `inav.rc[0].value` +- Object property access: `inav.flight.altitude`, `inav.rc[1].value` - Binary expressions: `+`, `-`, `*`, `/`, `%` - Comparison operators: `>`, `<`, `===` - Logical operators: `&&`, `||`, `!`