Skip to content

Conversation

Copy link

Copilot AI commented Dec 29, 2025

Calibration measurements are now sent individually as collected rather than batched in ESP32 memory, enabling concurrent calculation while measurement continues.

Changes

ESP32 Firmware

  • print_single_measurement(): Sends individual measurements in existing CLBM format
  • calibration_loop(): Transmits each measurement immediately after waypoint 6
  • First 6 points remain batched for initial frame estimation

Browser Processing

  • processIncrementalMeasurement(): Accumulates and optimizes on each measurement arrival
    • Runs 1000 iterations (vs 200K) for fast turnaround
    • Updates anchors when fitness exceeds threshold
    • Retains all measurements for continuous refinement
  • handleCalibrationData(): Routes single measurements to incremental processor

Flow

Initial phase (waypoints 0-5): Unchanged - batch processing establishes baseline

Incremental phase (waypoint 6+):

ESP32 measures → CLBM:[{...}] → Browser accumulates → Quick optimization
                                      ↓
                               Fitness > threshold?
                                      ↓
                           Yes: Update anchors
                                      ↓
                                  $ACKCAL
                                      ↓
                            ESP32 continues

Memory optimization for ESP32 calibration_data array deferred to follow-up if needed.

Original prompt

This section details on the original issue you should resolve

<issue_title>Calibration process communication mechanics rework</issue_title>
<issue_description>Please re-work the calibration process so that each measurement is sent after it is measured instead of being recorded in the ESP32 memory.

While measurements are being taken the browser side of things should be continuously doing calculations to improve the value.

After each new measurement is received by the browser it should be incorporated with all of the past measurements into the calculations. Once the calculations produce a value which is above the chosen calibration fitness threshold then the browser should send new anchor locations to the machine and tell it to move on to the next measurement. This may happen right away if the fitness is already good enough.

The behavior of the first six points used to compute the initial estimate of the frame size should not be effected the changes.

The detection of horizontal vs vertical mode should also not be impacted.

The purpose of doing this is to allow the calculations to be running at the same time that the machine is taking measurements to save time and also to reduce the memory usage on the ESP32 because we won't need to save all of the measurements there at the same time which will make larger grids possible.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 29, 2025 21:49
- Add print_single_measurement() to send individual measurements
- Modify calibration_loop to send measurements after first 6 points
- Add browser-side processIncrementalMeasurement() for incremental processing
- Browser now updates anchors when fitness threshold is met
- Measurements sent immediately after collection for concurrent processing

Co-authored-by: BarbourSmith <[email protected]>
- Don't clear measurement buffer when anchors are updated
- Measurements remain valid as they reflect actual belt lengths
- Improved anchors make future calculations more accurate
- Allows continuous refinement throughout calibration process

Co-authored-by: BarbourSmith <[email protected]>
- Document architecture and design decisions
- Explain calibration flow with diagrams
- Provide troubleshooting guide
- Include API reference and testing recommendations
- Detail future optimization opportunities

Co-authored-by: BarbourSmith <[email protected]>
Copilot AI changed the title [WIP] Rework calibration process communication mechanics Implement incremental calibration measurement processing Dec 29, 2025
Copilot AI requested a review from BarbourSmith December 29, 2025 21:58
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.

Calibration process communication mechanics rework

2 participants