From a6e56cee2e95ca11ae2716d00f92fdb21908f4fe Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 15 Sep 2023 19:31:52 +0200 Subject: [PATCH] Add note to help users with unintuitive behavior Add missing and fix wrong blocking --- serial/src/lib/TemperatureSensor.svelte | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/serial/src/lib/TemperatureSensor.svelte b/serial/src/lib/TemperatureSensor.svelte index 3a38c46..14f4685 100644 --- a/serial/src/lib/TemperatureSensor.svelte +++ b/serial/src/lib/TemperatureSensor.svelte @@ -88,6 +88,7 @@ async function writeBaudRate() { if (isBlocked || !sensor.isValidBaudRate(baudRate)) return; + isBlocked = true; baudRate = (await sensor.writeBaudRate( port, sensorAddress, @@ -96,7 +97,7 @@ )) ? baudRate : "error writing"; - isBlocked = true; + isBlocked = false; } async function readTemperatureCorrection() { @@ -117,6 +118,7 @@ if (!sensor.isValidCorrectionValue(temperatureCorrection) || isBlocked) return; + isBlocked = true; temperatureCorrection = (await sensor.writeTemperatureCorrection( port, sensorAddress, @@ -125,6 +127,8 @@ )) ? temperatureCorrection : "error writing"; + + isBlocked = false; } async function readHumidityCorrection() { @@ -176,8 +180,14 @@
+ + Note: The active device address and baud rate is read from holding register + to input register on power up. Therefore after wrting to the holding + register the input address does not change until the device is turned off + and on again. + Holding Registers - + -- 2.51.2