Save calibration payload format and live config
This commit is contained in:
@@ -350,12 +350,12 @@ async function saveCalibration() {
|
||||
|
||||
async function persistCalibration({requireAny}) {
|
||||
const zones = zoneIds
|
||||
.map((id) => ({id, polygon: state.polygons[id]}))
|
||||
.map((id) => ({id, polygon: serializePolygon(state.polygons[id])}))
|
||||
.filter((zone) => zone.polygon.length >= 3);
|
||||
const trashPolygon = state.polygons.trash;
|
||||
const payload = {zones, trash: {}};
|
||||
if (trashPolygon.length >= 3) {
|
||||
payload.trash.roi = trashPolygon;
|
||||
payload.trash.roi = serializePolygon(trashPolygon);
|
||||
}
|
||||
if (!zones.length && !payload.trash.roi) {
|
||||
if (requireAny) {
|
||||
@@ -370,6 +370,10 @@ async function persistCalibration({requireAny}) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function serializePolygon(points) {
|
||||
return points.map((point) => [point.x, point.y]);
|
||||
}
|
||||
|
||||
function setTab(tab) {
|
||||
state.activeTab = tab;
|
||||
document.querySelectorAll(".tabs button").forEach((button) => {
|
||||
|
||||
Reference in New Issue
Block a user