Wszystko jasne. Myślałem, że ten "Szpieg" sam jkoś przechwytuje to co idzie na serial i konwertuje pod siebie, ale zdaje się to tak nie działa...vajera wrote: Wed Dec 31, 2025 5:02 pmTo jest to, o czym pisałem w temacie własnej funkcji logującej - w swoim kodzie masz:SOYER wrote: Wed Dec 31, 2025 4:55 pm Ok, zrobiłem to na innej bibliotece i niby jest dobrze ale nie jest, @klew dlaczego nie widać logów z supli, a tylko te początkowe z uruchamiania modułu...
Szkic:Code: Select all
#include <SuplaDevice.h> #include <supla/sensor/DS18B20.h> #include <supla/network/esp_wifi.h> #include <TelnetSpy.h> //https://github.com/yasheena/telnetspy Supla::ESPWifi wifi("zz", "xx"); #include <OneWire.h> #include <DallasTemperature.h> #include <Timers.h> #include <ESP8266WiFi.h> #include <ESP8266mDNS.h> #include <WiFiUdp.h> /* ------------------------------------------------- */ #define SERIAL_SPEED 115200 #define WIFI_SSID "xx" #define WIFI_PASSWORD "xx" /* ------------------------------------------------- */ TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie int alarmPieca = 0; int temp_CWU; int temp_PIEC; int temp_POWROT; int temp_INSTALACJA; OneWire oneWire0(5);//D1 DallasTemperature czujnikCWU_POWROT(&oneWire0); DeviceAddress termometr_cwu = {0x28, 0xFF, 0xEF, 0x07, 0xB6, 0x01, 0x3C, 0xCF}; DeviceAddress termometr_powrot = {0x28, 0x5F, 0x17, 0x07, 0xB6, 0x01, 0x3C, 0x0B}; OneWire oneWire1(4);//D2 DallasTemperature czujnikPIEC_INSTALACJA(&oneWire1); DeviceAddress termometr_piec = {0x28, 0x15, 0x50, 0x07, 0xB6, 0x01, 0x3C, 0x09}; DeviceAddress termometr_instalacja = {0x28, 0xE8, 0x5C, 0x07, 0xB6, 0x01, 0x3C, 0x10}; int supla; char ssid[] = "xx"; char pass[] = "xx"; Timer minut5; Timer sekund3; void ds(){ czujnikPIEC_INSTALACJA.requestTemperatures(); temp_PIEC = (czujnikPIEC_INSTALACJA.getTempC(termometr_piec)+8); temp_INSTALACJA = czujnikPIEC_INSTALACJA.getTempC(termometr_instalacja); czujnikCWU_POWROT.requestTemperatures(); temp_CWU = (czujnikCWU_POWROT.getTempC(termometr_cwu)+7); temp_POWROT = (czujnikCWU_POWROT.getTempC(termometr_powrot)+8); } void setup() { // LOG inicjalizuje Serial automatycznie (domyślnie 115200) LOG.begin(SERIAL_SPEED); LOG.println("System uruchomiony z TelnetSpy."); // Pojawi się wszędzie WiFi.mode(WIFI_STA); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); while(WiFi.status() != WL_CONNECTED) { delay(500); LOG.print("."); // Postęp łączenia widoczny w Serial Monitor i na Telnet po połączeniu } LOG.println("\nPolaczono z siecia WiFi!"); LOG.print("Adres IP: "); LOG.println(WiFi.localIP()); // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid char GUID[SUPLA_GUID_SIZE] = {xx}; // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {xx}; new Supla::Sensor::DS18B20(5, termometr_cwu); new Supla::Sensor::DS18B20(5, termometr_powrot); new Supla::Sensor::DS18B20(4, termometr_piec); new Supla::Sensor::DS18B20(4, termometr_instalacja); SuplaDevice.begin(GUID, // Global Unique Identifier "svrxx.supla.org", // SUPLA server address "xx", // Email address used to login to Supla Cloud AUTHKEY); // Authorization key WiFi.begin(ssid, pass); czujnikPIEC_INSTALACJA.begin(); czujnikCWU_POWROT.begin(); sekund3.begin(2999); minut5.begin(59993); ds(); } void loop() { if(sekund3.available()){ LOG.println("co 3 sekundy"); sekund3.restart(); } SuplaDevice.iterate(); LOG.handle(); // Niezbędne do obsługi połączeń Telnet w tle // Przesylanie wejscia Z Telnetu NA Serial (automatycznie) while (LOG.available() > 0) { Serial.write(LOG.read()); } if(minut5.available()){ ds(); minut5.restart(); } }Ty jej używasz, ale SD już nie...I każda inna biblioteka, którą dodasz również jej nie będzie używać. Ten sam efekt możesz osiągnąć tą pierwszą biblioteką, jeżeli użyjesz własnej metody generowania logów - problem leży w tym, żeby przekierować logi z innych bibliotek.Code: Select all
TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie
Dziękuję
