parent
59bb0437e1
commit
02c335bc27
@ -50,12 +50,22 @@ router.ws('/', async (ws, req, next) => {
|
||||
|
||||
switch (msg.event) {
|
||||
case WebSocketEvent.CONTAINERS: {
|
||||
let data = msg.data as { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; useProxy: boolean }[];
|
||||
await Container.deleteMany({}); // V2: Remove this and check every container based on id if changes occurs
|
||||
let data = msg.data as { id?: string, pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; useProxy: boolean }[];
|
||||
// await Container.deleteMany({}); // V2: Remove this and check every container based on id if changes occurs
|
||||
|
||||
let i = 0;
|
||||
for (let c of data) {
|
||||
let container = new Container();
|
||||
let container : IContainer | null = null;
|
||||
|
||||
if( c.id )
|
||||
{
|
||||
container = await Container.findOne( {_id: c.id } );
|
||||
}
|
||||
|
||||
if( !container )
|
||||
container = new Container();
|
||||
|
||||
|
||||
container.slot = i;
|
||||
//container.volume = c.volume; // V2: Removed
|
||||
container.pumpPin = c.pumpPin;
|
||||
|
@ -12,13 +12,11 @@ import {RequestType} from "../RequestType";
|
||||
|
||||
export class Setup {
|
||||
|
||||
public static arduinoProxyCheckboxes: HTMLInputElement[] = [];
|
||||
private static usingProxy = false;
|
||||
|
||||
private static pins_pi = [3, 7, 8, 10, 11, 12, 13, 15, 16, 18, 19, 21, 22, 23, 24, 26, 29, 31, 32, 33, 35, 36, 37, 38];
|
||||
private static pins_arduino = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53];
|
||||
|
||||
public static arduinoProxyCheckboxes: HTMLInputElement[] = [];
|
||||
|
||||
public static onConfigUpdate(payload: WebSocketPayload) {
|
||||
// Setup containers updated
|
||||
const ledGPIO = document.getElementById("ledGPIO") as HTMLInputElement;
|
||||
@ -34,8 +32,7 @@ export class Setup {
|
||||
this.usingProxy = proxyCheckbox.checked;
|
||||
for (let checkbox of this.arduinoProxyCheckboxes) {
|
||||
checkbox.disabled = !proxyCheckbox.checked;
|
||||
if( !proxyCheckbox.checked )
|
||||
{
|
||||
if (!proxyCheckbox.checked) {
|
||||
checkbox.checked = false;
|
||||
let event = new Event('change', {bubbles: true});
|
||||
checkbox.dispatchEvent(event); // Trigger virtual onChange event
|
||||
@ -162,8 +159,6 @@ Dort werden die Behälter definiert, welche in den iTender gestellt werden.<br>D
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const ledCheckbox = document.getElementById("ledCheckbox") as HTMLInputElement;
|
||||
const ledGPIO = document.getElementById("ledGPIO") as HTMLInputElement;
|
||||
const ambientColor = document.getElementById("ambientColor") as HTMLInputElement;
|
||||
@ -173,7 +168,7 @@ Dort werden die Behälter definiert, welche in den iTender gestellt werden.<br>D
|
||||
|
||||
|
||||
// Containers
|
||||
let cons: { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; useProxy: boolean }[] = [];
|
||||
let cons: { id: string, pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; useProxy: boolean }[] = [];
|
||||
for (let c of (document.getElementById("setupContainers") as HTMLDivElement).getElementsByTagName("div")) {
|
||||
let sensorType = c.getElementsByTagName("select")[1].value;
|
||||
let type;
|
||||
@ -189,7 +184,8 @@ Dort werden die Behälter definiert, welche in den iTender gestellt werden.<br>D
|
||||
"pumpPin": parseInt(c.getElementsByTagName("select")[0].value),
|
||||
"sensorType": type,
|
||||
"sensor1": parseInt(c.getElementsByTagName("select")[2].value),
|
||||
"sensor2": parseInt(c.getElementsByTagName("select")[3].value)
|
||||
"sensor2": parseInt(c.getElementsByTagName("select")[3].value),
|
||||
"id": c.id,
|
||||
});
|
||||
}
|
||||
let newConf = {
|
||||
@ -231,7 +227,6 @@ Dort werden die Behälter definiert, welche in den iTender gestellt werden.<br>D
|
||||
|
||||
setTimeout(() => {
|
||||
saveModal.close();
|
||||
|
||||
this.startTare();
|
||||
}, 1000);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user