Skip to content

Changing structure names and hardware configuration of IVY VESC#756

Open
TaixiLu wants to merge 26 commits into
vedderb:masterfrom
TaixiLu:master
Open

Changing structure names and hardware configuration of IVY VESC#756
TaixiLu wants to merge 26 commits into
vedderb:masterfrom
TaixiLu:master

Conversation

@TaixiLu

@TaixiLu TaixiLu commented Aug 27, 2024

Copy link
Copy Markdown

No description provided.

TaixiLu and others added 26 commits August 10, 2024 18:17
applications/app_ppm_brake.c: custom user app combining PPM throttle,
proportional ADC2 brake, and ADC1 as a 0..1 gain knob scaling both
throttle and brake, plus reverse (UART_RX) and cruise (UART_TX) buttons.
Brake has priority and bypasses safe-start + PPM signal-loss timeout;
safe-start gates the PPM throttle only and arms on the pre-gain stick.
Single signed output ramp; throttle ramp from PPM page, brake ramp from
ADC page. Enabled via APP_CUSTOM_TO_USE in the board header.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Values-only tuning (no reformatting), on top of the PPM+brake custom app:
- HW_DEAD_TIME_NSEC 1000 -> 300
- MCCONF_L_MIN_VOLTAGE 12 -> 20 ; MCCONF_L_MAX_VOLTAGE 110 -> 100
- HW_LIM_CURRENT +/-500 -> +/-1200 ; HW_LIM_CURRENT_ABS 650 -> 1500
- HW_LIM_VIN min 6 -> 20 ; HW_LIM_TEMP_FET max 110 -> 90

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Better reflects the app: PPM throttle + ADC2 brake + ADC1 gain knob.
Renames the file, the APP_CUSTOM_TO_USE reference, the thread function/
working area symbols, and the registered thread name. No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…witch

- ppm_adc_dbg terminal command prints the LIVE PPM/ADC1/ADC2/gain/brake/
  throttle/cmd values. VESC Tool's ADC RT tab reads dormant ADC-app
  telemetry (0 under a custom app), so this is the real on-device probe.
- USE_ADC1_GAIN compile switch (default 1). Set to 0 to force gain=1.0 so
  PPM-only bench testing works when nothing is wired to ADC1 (otherwise a
  low/unwired ADC1 maps to gain 0 and zeroes the throttle).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
app_adc_get_voltage()/voltage2() returned a static updated only by the ADC
app thread, so VESC Tool's ADC readout showed a stale 0 under any other app
(e.g. a custom app). Fall back to the live ADC_VOLTS() pin when !is_running
so the readout reflects the real hardware voltage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reverts 55699a8 so app_adc.c stays identical to upstream (mergeable).
Live ADC visibility for the custom app is provided by the in-file
ppm_adc_dbg terminal command instead of touching shared code.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Self-contained live telemetry with no shared-code (app_adc/commands) edits.
ppm_adc_plot terminal command (1=on/0=off/toggle) streams ADC1 V, ADC2 V,
gain, throttle and brake as 5 curves to VESC Tool's Realtime Data ->
Experiment tab, throttled to ~20 Hz. This is the official custom-app way to
visualise live data (commands_init_plot / commands_send_plot_points), since
the built-in ADC RT tab is hard-wired to the dormant app_adc getters.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…igger stack

- PPM throttle now uses full stick travel: throttle = (servo+1)/2. servodec
  maps pulse_start..pulse_end to -1..1; the old truncate(0,1) discarded the
  lower half so the throttle only responded past mid-stick ("press deep").
- Add USE_ADC2_BRAKE switch (default 1, #ifndef-guarded like USE_ADC1_GAIN).
  Set 0 when ADC2 is not wired so a floating brake pin can't force brake
  priority (which blocks throttle and injects brake current at standstill).
- Bump thread stack 1024 -> 2048 as headroom for the plot/printf paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…start telemetry

Root cause of "motor only runs after connecting VESC Tool": we never fed the
global timeout on PPM pulses. If has_timeout latched during the boot/arming
window, the drive gate bailed to brake WITHOUT calling timeout_reset(), so it
stayed latched until an external reset (VESC Tool COMM_ALIVE). Now reset the
timeout on every PPM pulse (servo_func sets ppm_rx), matching the stock PPM app.

Also:
- Force throttle 0 when no valid PPM signal (servo_pos defaults to 0 which the
  new (servo+1)/2 mapping turned into 0.5); lets safe-start arm during the
  no-signal boot window and removes a phantom mid-throttle.
- Add safe-start/PPM-signal status to ppm_adc_dbg and a "armed" curve + "cmd"
  curve to the Experiment plot (graphs: ADC1 V, ADC2 V, throttle, cmd, armed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Value-only change (no reformatting).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stops editors with format-on-save from reformatting the tab-indented VESC
sources, which caused whole-file whitespace diffs and merge conflicts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The ADC1 power-ratio (gain) and the reverse direction are now re-sampled only
while the motor is at standstill AND the throttle is released, then held for the
whole ride. Prevents changing power level or flipping direction mid-drive.
"Standstill" = |erpm| < PPM-page max_erpm_for_dir (fallback 2000). Latched values
shown in ppm_adc_dbg. Change is entirely within the custom app; no stock apps
touched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant