Description
Provide a user-friendly interface for calibrating an EZO-pH sensor. This modal will allow the user to send specific calibration commands and see the sensor's response.
Tasks
- In
data/index.html, add a "Calibrate" button to the sensor management UI for EZO-pH sensors. This button should open a new modal.
- Design the calibration modal with buttons for "Calibrate Mid (7.0)", "Calibrate Low (4.0)", "Calibrate High (10.0)", "Clear Calibration", and "Check Status".
- Add a display area in the modal for the sensor's last response.
- In
data/script.js, create a sendCalibrateCommand(command) function that POSTs the command to the /api/sensor/command endpoint.
- Update the
updateIOStatus function to continuously refresh the response text inside the calibration modal when it is open.
Example Code
In data/script.js:
function sendCalibrateCommand(command) {
fetch('/api/sensor/command', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ index: currentSensorIndex, command: command })
}).then(res => {
if (res.ok) showToast("Command sent!", "info");
else showToast("Failed to send command.", "error");
});
}
// In updateIOStatus()
const calResponseSpan = document.getElementById('cal-response');
if (calResponseSpan) {
calResponseSpan.innerText = data.sensors_data[currentSensorIndex].response;
}
Acceptance Criteria
- The user can open the calibration modal for a pH sensor.
- Clicking a calibration button sends the correct command to the device.
- The response from the EZO circuit (e.g.,
*OK or an error code) is displayed in the modal in near real-time.
Description
Provide a user-friendly interface for calibrating an EZO-pH sensor. This modal will allow the user to send specific calibration commands and see the sensor's response.
Tasks
data/index.html, add a "Calibrate" button to the sensor management UI for EZO-pH sensors. This button should open a new modal.data/script.js, create asendCalibrateCommand(command)function that POSTs the command to the/api/sensor/commandendpoint.updateIOStatusfunction to continuously refresh the response text inside the calibration modal when it is open.Example Code
In
data/script.js:Acceptance Criteria
*OKor an error code) is displayed in the modal in near real-time.