Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tools/calibrator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ <h4 class="font-semibold text-gray-900 mb-4">Serial connection</h4>
<span class="status-dot disconnected" id="serialStatus"></span>
<span class="ml-2 text-sm" id="serialStatusText">Not connected</span>
</div>
<button id="connectBtn"
class="btn-primary px-4 py-2 rounded-lg text-sm font-medium">Connect</button>
<div class="flex items-center gap-3">
<span id="baudSelector"></span>
<button id="connectBtn"
class="btn-primary px-4 py-2 rounded-lg text-sm font-medium">Connect</button>
</div>
</div>
<p class="text-xs text-gray-500">
Click Connect and select your printer's serial port (usually contains "USB" or "CH340").
Expand Down Expand Up @@ -832,6 +835,7 @@ <h4 class="font-semibold text-blue-600 mb-2">Z error</h4>
<script src="../shared/file-downloader.js"></script>
<script src="../shared/wizard-framework.js"></script>
<script src="../shared/printer-interface.js"></script>
<script src="../shared/baud-selector.js"></script>
<script src="../shared/camera-manager.js"></script>
<script src="../shared/inverse-kinematics.js"></script>
<script src="../shared/calibration-corrector.js"></script>
Expand All @@ -849,6 +853,7 @@ <h4 class="font-semibold text-blue-600 mb-2">Z error</h4>
<script src="js/calibration.js"></script>
<script src="js/results.js"></script>
<script src="js/app.js"></script>
<script>BaudSelector.mount('baudSelector');</script>
</body>

</html>
8 changes: 8 additions & 0 deletions tools/firmware-builder/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,14 @@ function exportConfig(showToastNotification = true) {
// Download as JSON using shared utility
downloadJSON(exportData, filename);

// Also stash the config in localStorage so the Firmware Tester can pick it up
// automatically, without forcing the user to re-upload the file.
try {
localStorage.setItem('rep5x_firmware_builder_config', JSON.stringify(exportData));
} catch (e) {
console.warn('Could not save firmware config to localStorage:', e);
}

// Show feedback toast
if (showToastNotification) {
showToast('Configuration saved', 'save');
Expand Down
47 changes: 47 additions & 0 deletions tools/firmware-tester/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Firmware Tester

Browser-based tool that verifies a freshly flashed Rep5x Marlin firmware against the hardware it's running on, and produces a corrected Firmware Builder JSON config if anything is wired backwards.

## What it checks

1. **Diagnostics**: `M115` (firmware ID), `M122` (TMC driver UART), `M119` (no endstop currently triggered), `M105` (thermistors read room temperature).
2. **Endstop walk-through**: for each endstop (X, Y, Z, B microswitch, C optical sensor), the user is prompted to manually trigger it; the tool polls `M119` until the state flips.
3. **Stepper directions**: sends a small relative move on each axis (X/Y/Z/C/B) and asks the user whether it moved as expected.
4. **Homing direction**: for axes whose endstops passed, sends `G28 X` etc. and asks whether the carriage moved *toward* the endstop.
5. **Extruder**: direction test, plus optional E-steps calibration via "extrude 100 mm, measure how much actually came out".

## Output

If a Firmware Builder JSON config was uploaded at the start, the tester produces a `*-corrected.json` with the discovered fixes applied:

- Stepper direction reversed → `invert<axis>` flipped
- Homing direction reversed → `<axis>HomeDir` sign flipped
- Extruder reversed → `invertE` flipped
- E-steps calibrated → `stepsE` updated

Re-import the corrected JSON into the Firmware Builder, regenerate, re-flash, and run the tester again to confirm.

## Where it sits in the workflow

1. **Firmware Builder** → configure → download `firmware.bin` (and the JSON config alongside)
2. **Firmware Tester** ← *(this tool)*: verify the flash worked, fix any reversals
3. **Printer Setup** → kinematic calibration

## Files

- `index.html`: wizard skeleton (7 steps, Tailwind-based)
- `js/app.js`: entry point, wizard init, results aggregation
- `js/connect.js`: connection step (uses `StepConnectBase` from shared/)
- `js/diagnostics.js`: M115 / M122 / M119 / M105 checks
- `js/endstop-test.js`: manual endstop trigger walk-through
- `js/stepper-test.js`: stepper direction prompts
- `js/homing-test.js`: homing direction config-vs-physical-side check (no motor moves)
- `js/extruder-test.js`: extruder direction + optional E-steps calibration
- `js/results.js`: summary view + corrected JSON output
- `styles.css`: small tool-specific overrides on top of shared/styles.css

Shared dependencies:
- `shared/printer-interface.js` (now extended with `queryEndstops`, `queryDriverStatus`, `queryFirmwareInfo`)
- `shared/wizard-framework.js`
- `shared/step-connect-base.js`
- `shared/storage-manager.js`
Loading