@Malarz
Dzięki za wyjasnienie.
Odnośnie scd4x->getTemp(), chodziło mi o to że wszystkie trzy generują błędy odczytu w logach (SCD4x read error).
SCD41 na SuplaDevice przez KPOP - jak wyciągac dane
-
malarz
- Posts: 506
- Joined: Wed Jan 27, 2021 4:04 pm
- Been thanked: 2 times
Wrzuć tu kawałek loga i cały kod, który go daje. Spróbuję to zdiagnozować.Marian1544 wrote: Fri Jan 23, 2026 8:39 pm @Malarz
Dzięki za wyjasnienie.
Odnośnie scd4x->getTemp(), chodziło mi o to że wszystkie trzy generują błędy odczytu w logach (SCD4x read error).
Próbuję przerobić pomysły na działające projekty w ArduinoIDE.
-
Marian1544
- Posts: 64
- Joined: Sat Aug 28, 2021 4:45 pm
Kod:
Log:
Code: Select all
#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/sensor/SCD4x.h>
#include <supla/storage/littlefs_config.h>
#include <supla/network/esp_web_server.h>
#include <supla/network/html/device_info.h>
#include <supla/network/html/protocol_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/network/html/i2cscanner.h>
#include <supla/network/html/button_update.h>
#include <supla/device/status_led.h>
#include <supla/control/button.h>
#include <supla/sensor/DS18B20.h>
#include <supla/clock/clock.h>
#include <LiquidCrystal_I2C.h>
#define DEV_NAME "SCD4x test"
#define BUTTON_CFG_GPIO 0
#define STATUS_LED_GPIO 2
#define DS18B20_GPIO D3
#define SDA_PIN D2
#define SCL_PIN D1
Supla::Clock suplaClock;
Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;
Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::EspWebServer suplaServer;
Supla::Sensor::SCD4x *scd4x = nullptr;
Supla::Sensor::DS18B20 *ds18b20 = nullptr;
auto buttonCfg = new Supla::Control::Button(BUTTON_CFG_GPIO, true, true);
LiquidCrystal_I2C lcd(0x27,20,4);
unsigned long lastRead = 0;
int parzyste = 0;
void setup() {
Serial.begin(115200);
// WevInterface with Update
new Supla::Html::DeviceInfo(&SuplaDevice);
new Supla::Html::WifiParameters;
new Supla::Html::ProtocolParameters;
// new Supla::Html::StatusLedParameters;
new Supla::Html::ButtonUpdate(&suplaServer);
buttonCfg->configureAsConfigButton(&SuplaDevice);
// I2C start & scan
Wire.begin(SDA_PIN, SCL_PIN);
new Supla::Html::I2Cscanner();
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("SUPLA SCD41");
scd4x = new Supla::Sensor::SCD4x();
ds18b20 = new Supla::Sensor::DS18B20(DS18B20_GPIO);
SuplaDevice.setName(DEV_NAME);
SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
SuplaDevice.begin();
lcd.clear();
}
void loop() {
SuplaDevice.iterate();
if (millis() - lastRead > 3000) {
lastRead = millis();
printf("TestBuffer: %f ----------------\n", scd4x->getTemp());
}
}
Log:
Code: Select all
GPM[1]: DefaultUnitAfterValue "ppm"
Channel[1] initial caption set to 'CO₂'
GPM[1]: DefaultValuePrecision 1
Creating OneWire bus for pin: 0
Initializing OneWire bus at pin 0
OneWire(pin 0) Parasite power is OFF
OneWire(pin 0) Found 0 devices:
Device address not provided. Using device from index 0
SD: initial mode: Start in cfg mode (legacy, deprected)
*** Supla - starting initialization (platform 0)
SD: add flag DEVICE_CONFIG_SUPPORTED
SD: add flag CALCFG_RESTART_DEVICE
Main storage not configured
LittleFsConfig: file "/supla-dev.cfg" size 569
LittleFsConfig: initializing storage from file...
LittleFsConfig: init result success
*** Supla - Config initalization
SD: add flag CALCFG_ENTER_CFG_MODE
SD: add flag CALCFG_FACTORY_RESET_SUPPORTED
Automatic firmware update is disabled
Device mode: 0
Security level: Supla CA
*** Supla - Config load for elements
RemoteDeviceConfig: Registering field 0x000000010
Clock: automaticTimeSync: 1
SD: add flag CALCFG_IDENTIFY_DEVICE
RemoteDeviceConfig: Registering field 0x000000001
Button[0] don't load config
Channel[0] temperature correction 0.00
Channel[0] humidity correction 0.00
GPM[1]: config loaded successfully
GPM[1]: RefreshIntervalMs 5000 ms
Channel[2] temperature correction 0.00
Channel[2] humidity correction 0.00
*** Supla - Config load for elements done
*** Supla - Init elements
Button[0]: Initialized: pin 0, pullUp 1, invertLogic 1, state 1
SCD4x Sensor detected.
Channel(1) value changed to NaN
Channel(2) value changed to -275.00
*** Supla - Init elements done
GUID: CD:******************-
Device name: SCD4x test
Device software version: SDK 25.11-dev
*** Supla - Initializing network layer
[Wi-Fi] Network AP/hostname: SCD4X:******************-
Using Supla protocol version 23
Current status: [5] SuplaDevice initialized
Enter normal mode
[Wi-Fi] setNormalMode
*** Supla - Initialization done
*** Self-test ***
TEST: ManufacturerID is 0
TEST failed: ProductID is empty
TEST failed: missing public RSA key
TEST failed: automatic firmware update is disabled
TEST failed: config encryption is disabled
TEST failed: invalid certificates format
TEST failed: security log is disabled
TEST failed: initial mode is set to config mode
*** Self-test done ***
WiFi: establishing connection with SSID: "iii"
SCD4x read error
TestBuffer: -275.000000 ----------------
SCD4x read error
TestBuffer: -275.000000 ----------------
WiFi station disconnected
TestBuffer: 25.036316 ----------------
SCD4x read error
Channel(0) value changed to temp(25.04), humi(31.58)
Channel(1) value changed to 1176.00
TestBuffer: 24.715881 ----------------
Warning: network is not ready (10 s)
Connected BSSID: A8:******************-
local IP: 192.168.1.52
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.1
Signal strength (RSSI): -43 dBm
Establishing encrypted connection with: svr:******************-org (port: 2016)
Waiting for NTP time sync
Connected via IP 192.:******************-
Connected to Supla Server
Initializing SRPC (proto: 23)
LAST STATE ADDED: Register in progress (13)
Current status: [10] Register in progress
Send: [53 55 50 4C 41 17 01 00 00 00 4B 00 00 00 B1 02 00 00 74 65 73 74 5F 70 6C 61 79 39 39 40 67 6F 32 2E 70 6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 AC 3E B6 18 46 19 91 BA 02 04 27 8F 75 C9 98 CD 6B 35 04 F2 FB 8C 8D 33 60 FC 91 8D FF AC 03 53 43 44 34 78 20 74 65 73 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
CH[0], type: 3038, FuncList: 0x0, function: 45, flags: 0x008010000, online, validityTimeSec: 0, icon: 0, value: [cc 61 00 00 57 7b 00 00]
Send: [00 DE 0B 00 00 00 00 00 00 2D 00 00 00 00 00 01 08 00 00 00 00 00 00 00 00 00 CC 61 00 00 57 7B 00 00 00 ]
CH[1], type: 9000, FuncList: 0x0, function: 520, flags: 0x008010000, online, validityTimeSec: 0, icon: 8, value: [00 00 00 00 00 60 92 40]
Send: [01 28 23 00 00 00 00 00 00 08 02 00 00 00 00 01 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 92 40 08 ]
CH[2], type: 3034, FuncList: 0x0, function: 40, flags: 0x008010000, online, validityTimeSec: 0, icon: 0, value: [00 00 00 00 00 30 71 c0]
Send: [02 DA 0B 00 00 00 00 00 00 28 00 00 00 00 00 01 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 71 C0 00 ]
Send: [53 55 50 4C 41 ]
SCD4x read error
TestBuffer: 24.715881 ----------------
Channel(1) value changed to 1231.00
Recv: [53 55 50 4C 41 17 01 00 00 00 46 00 00 00 07 00 00 00 03 00 00 00 78 1C 01 53 55 50 4C 41 ]
Device registered (activity timeout 120 s, server version: 28, server min version: 1)
LAST STATE ADDED: Registered and ready (16)
Current status: [17] Registered and ready
Changing activity timeout to 30 s
Send: [53 55 50 4C 41 17 02 00 00 00 D2 00 00 00 01 00 00 00 1E ]
Send: [53 55 50 4C 41 ]
Send: [53 55 50 4C 41 17 03 00 00 00 E0 01 00 00 00 00 00 00 ]
Send: [53 55 50 4C 41 ]
Recv: [53 55 50 4C 41 17 02 00 00 00 AD 02 00 00 1D 00 00 00 01 00 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 02 00 01 01 53 55 50 4C 41 ]
Received new device config
Processing StatusLed config
Processing AutomaticTimeSync config
Sending device config result OK (1)
Send: [53 55 50 4C 41 17 04 00 00 00 B7 02 00 00 0A 00 00 00 01 00 00 00 00 00 00 00 00 00 ]
Send: [53 55 50 4C 41 ]
Send: [53 55 50 4C 41 17 05 00 00 00 67 00 00 00 0E 00 00 00 01 00 00 00 00 00 00 00 00 00 00 3C 93 40 ]
Send: [53 55 50 4C 41 ]
Send: [53 55 50 4C 41 17 06 00 00 00 80 02 00 00 0E 00 00 00 01 07 83 03 06 00 00 00 43 4F E2 82 82 00 ]
Send: [53 55 50 4C 41 ]
Recv: [53 55 50 4C 41 17 03 00 00 00 AA 02 00 00 28 00 00 00 00 2D 00 00 00 00 20 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 55 50 4C 41 ]
Channel[0] Received SetChannelConfig: fnc 45, config type 0, config size 32
Channel[0] handleChannelConfig, func 45, configtype 0, configsize 32
Channel[0] temperature correction 0.00
Channel[0] humidity correction 0.00
Channel[0] ConfigType 0 applied
Channel[0] Sending SetChannelConfigResult OK (1)
Send: [53 55 50 4C 41 17 07 00 00 00 B4 02 00 00 03 00 00 00 01 00 00 ]
Send: [53 55 50 4C 41 ]
Channel(0) value changed to temp(24.48), humi(32.67)
Recv: [53 55 50 4C 41 17 04 00 00 00 AB 02 00 00 01 00 00 00 00 53 55 50 4C 41 ]
Channel[0] Received ChannelConfigFinished
Send: [53 55 50 4C 41 17 08 00 00 00 67 00 00 00 0E 00 00 00 00 00 00 00 00 00 A0 5F 00 00 A1 7F 00 00 ]
Send: [53 55 50 4C 41 ]
Recv: [53 55 50 4C 41 17 05 00 00 00 AA 02 00 00 74 00 00 00 01 08 02 00 00 00 6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 70 6D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 70 6D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 55 50 4C 41 ]
Channel[1] Received SetChannelConfig: fnc 520, config type 0, config size 108
Channel[1] handleChannelConfig, func 520, configtype 0, configsize 108
GPM[1]: RefreshIntervalMs 5000 ms
Channel[1] ConfigType 0 applied
Channel[1] Sending SetChannelConfigResult OK (1)
Send: [53 55 50 4C 41 17 09 00 00 00 B4 02 00 00 03 00 00 00 01 00 01 ]
Send: [53 55 50 4C 41 ]
Recv: [53 55 50 4C 41 17 06 00 00 00 AB 02 00 00 01 00 00 00 01 53 55 50 4C 41 ]
Channel[1] Received ChannelConfigFinished
Recv: [53 55 50 4C 41 17 07 00 00 00 AA 02 00 00 28 00 00 00 02 28 00 00 00 00 20 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 55 50 4C 41 ]
Channel[2] Received SetChannelConfig: fnc 40, config type 0, config size 32
Channel[2] handleChannelConfig, func 40, configtype 0, configsize 32
Channel[2] temperature correction 0.00
Channel[2] humidity correction 0.00
Channel[2] ConfigType 0 applied
Channel[2] Sending SetChannelConfigResult OK (1)
Send: [53 55 50 4C 41 17 0A 00 00 00 B4 02 00 00 03 00 00 00 01 00 02 ]
Send: [53 55 50 4C 41 ]
Recv: [53 55 50 4C 41 17 08 00 00 00 AB 02 00 00 01 00 00 00 02 53 55 50 4C 41 ]
Channel[2] Received ChannelConfigFinished
Recv: [53 55 50 4C 41 17 09 00 00 00 DC 00 00 00 03 00 00 00 1E 0A F0 53 55 50 4C 41 ]
Activity timeout set to 30 s
Recv: [53 55 50 4C 41 17 0A 00 00 00 EA 01 00 00 1A 00 00 00 EA 07 01 18 07 0B 24 18 0E 00 00 00 45 75 72 6F 70 65 2F 57 61 72 73 61 77 00 53 55 50 4C 41 ]
Clock: current time: 2026-01-24 10:36:25
Clock: time diff (system-new): -3599 s
Clock: new time: 2026-01-24 11:36:24
Recv: [53 55 50 4C 41 17 0B 00 00 00 8A 02 00 00 0F 00 00 00 01 07 83 03 1A 06 00 00 00 43 4F E2 82 82 00 53 55 50 4C 41 ]
Channel[1] Receieved setChannelCaptionResult
SCD4x read error
TestBuffer: 24.480896 ----------------
Channel(1) value changed to 1246.00
Send: [53 55 50 4C 41 17 0B 00 00 00 67 00 00 00 0E 00 00 00 01 00 00 00 00 00 00 00 00 00 00 78 93 40 ]
Send: [53 55 50 4C 41 ]
LittleFsConfig: writing to file "/supla-dev.cfg"
LittleFsConfig: writing to file "/supla-dev.cfg.bak"
TestBuffer: 24.243240 ----------------
-
Bania
- Posts: 107
- Joined: Wed Jul 24, 2024 5:03 pm
- Location: Bielsko-Biała
- Has thanked: 5 times
- Been thanked: 5 times
Code: Select all
SCD4x Sensor detected.Code: Select all
(scd.begin() == true)Code: Select all
SCD4x read errorCode: Select all
(scd.readMeasurement() == false)Code: Select all
#include <Wire.h>https://github.com/anarhbania/Supla
-
Marian1544
- Posts: 64
- Joined: Sat Aug 28, 2021 4:45 pm
@Bania
Nie, dodanie #include <Wire.h> nic nie zmienia.
Ale chyba niema co tego drążyć skoro scd4x->getChannel()->getValueDoubleFirst() działa bez błędów.
Nie, dodanie #include <Wire.h> nic nie zmienia.
Ale chyba niema co tego drążyć skoro scd4x->getChannel()->getValueDoubleFirst() działa bez błędów.
-
malarz
- Posts: 506
- Joined: Wed Jan 27, 2021 4:04 pm
- Been thanked: 2 times
Błąd, o którym pisze @Marian1544 jest spowodowany najprawdopodobniej za częstym wywołaniem funkcji readValuesFromDevice().klew wrote: Fri Jan 23, 2026 2:36 pm Crash wygląda jakby leciał przy rejestacji do serwera i jakby nie miał związku z tymi lcd.print.
Ja bym tego "if" w loop rozbił na framgenty i wstawił wszędzie logi debugowe. Dodatkowo najpierw pobierz do double odczyt, a w osobnej linii daj print (w logami pomiędzy).
Alternatywnie zdekoduj callstack - może będzie coś widać, choć na oko wygląda ubogo.
Czy ta linia:
https://github.com/malarz-supla/supla-d ... CD4x.h#L44
powinna tam być, czy ta funkcja i tak jest wołana cyklicznie przez jakąś nadrzedną klasę?
Próbuję przerobić pomysły na działające projekty w ArduinoIDE.
-
klew
- Posts: 13905
- Joined: Thu Jun 27, 2019 12:16 pm
- Location: Wrocław
- Has thanked: 134 times
- Been thanked: 137 times
Tak, ona tam powinna być, choć nie jest to zbyt eleganckiemalarz wrote: Sat Jan 24, 2026 5:58 pmBłąd, o którym pisze @Marian1544 jest spowodowany najprawdopodobniej za częstym wywołaniem funkcji readValuesFromDevice().klew wrote: Fri Jan 23, 2026 2:36 pm Crash wygląda jakby leciał przy rejestacji do serwera i jakby nie miał związku z tymi lcd.print.
Ja bym tego "if" w loop rozbił na framgenty i wstawił wszędzie logi debugowe. Dodatkowo najpierw pobierz do double odczyt, a w osobnej linii daj print (w logami pomiędzy).
Alternatywnie zdekoduj callstack - może będzie coś widać, choć na oko wygląda ubogo.
Czy ta linia:
https://github.com/malarz-supla/supla-d ... CD4x.h#L44
powinna tam być, czy ta funkcja i tak jest wołana cyklicznie przez jakąś nadrzedną klasę?
Najlepsze suple dla Twojego domu 
-
malarz
- Posts: 506
- Joined: Wed Jan 27, 2021 4:04 pm
- Been thanked: 2 times
Dzięki @klew.
@Marian1544 tym błędem w tych warunkach nie ma się po co przejmować. Ale lepiej zawsze czytać z "CalculatedValue" bo to jest wartość po dostrojeniu parametrami ustawianymi w cloud.
@Marian1544 tym błędem w tych warunkach nie ma się po co przejmować. Ale lepiej zawsze czytać z "CalculatedValue" bo to jest wartość po dostrojeniu parametrami ustawianymi w cloud.
Próbuję przerobić pomysły na działające projekty w ArduinoIDE.
