Najnowsze wersje SD i przykłady

Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

@vajera

Code: Select all

SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode); 
SuplaDevice.begin();
Ten kod jest w standardowym przykładzie na webinterface dla ESP8266.
Jest tam też obsługa przycisku config pod klawiszem GPIO0 (przycisk flash na Node MCU).
Ale nie ma reakcji (AP się nie pokazuje).
Chyba że to do czegoś innego służy:

Code: Select all

auto buttonCfgRelay = new Supla::Control::Button(BUTTON_CFG_RELAY_GPIO, true, true);
A co jeżeli nie było by wcale webinterface, jak wtedy dodać konfig?
User avatar
lesny8
Posts: 3132
Joined: Mon Dec 11, 2017 9:43 pm
Has thanked: 10 times
Been thanked: 9 times

Post

Przytrzymaj przycisk CFG, po 5s uruchomi się AP, ja tak miałem na wemosie D1 mini.
Jak chcesz od razu wystartować AP na czystym firmware, napisz tak jak @vajera podrzucił.
SOP 2023 :heavy_check_mark:
SOP 2024 :heavy_check_mark:
Czekam na kolejne Supla Offline Party :upside_down_face:
🧩: 🔑cz->b ⛴️+ila
Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Ok już znalazłem przyczynę, mój bład.
Miałem ustawioną płytkę na nodeMCU 0.9 zamiast 1.0.
Teraz już działa.

Dzięki za podpowiedzi.
User avatar
Bania
Posts: 107
Joined: Wed Jul 24, 2024 5:03 pm
Location: Bielsko-Biała
Has thanked: 5 times
Been thanked: 5 times

Post

Moim zdaniem, można jeszcze dodać jeden przykład do katalogu "esp", nazwać go Simple.
Przykład bazowy z minimalną ilością kodu, include, żeby był dostęp do CFG poprzez przycisk oraz automatycznie po wgraniu programu.

Code: Select all

/*
  Copyright (C) AC SOFTWARE SP. Z O.O.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#define BUTTON_CFG_GPIO 0
#define STATUS_LED_GPIO 2

#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/device/status_led.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/status_led_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/control/button.h>
#include <supla/storage/eeprom.h>

Supla::Eeprom eeprom;

Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;

Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::EspWebServer suplaServer;

auto buttonCfg = new Supla::Control::Button(BUTTON_CFG_GPIO, true, true);

void setup() {
  Serial.begin(115200);

  buttonCfg->configureAsConfigButton(&SuplaDevice);

  // HTML www component
  new Supla::Html::DeviceInfo(&SuplaDevice);
  new Supla::Html::WifiParameters;
  new Supla::Html::ProtocolParameters;
  new Supla::Html::StatusLedParameters;

  SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
  SuplaDevice.begin();
}

void loop() {
  SuplaDevice.iterate();
}
https://github.com/anarhbania/Supla
User avatar
klew
Posts: 13905
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Bania wrote: Sat Jan 17, 2026 2:24 pm Moim zdaniem, można jeszcze dodać jeden przykład do katalogu "esp", nazwać go Simple.
Przykład bazowy z minimalną ilością kodu, include, żeby był dostęp do CFG poprzez przycisk oraz automatycznie po wgraniu programu.

Code: Select all

/*
  Copyright (C) AC SOFTWARE SP. Z O.O.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#define BUTTON_CFG_GPIO 0
#define STATUS_LED_GPIO 2

#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/device/status_led.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/status_led_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/control/button.h>
#include <supla/storage/eeprom.h>

Supla::Eeprom eeprom;

Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;

Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::EspWebServer suplaServer;

auto buttonCfg = new Supla::Control::Button(BUTTON_CFG_GPIO, true, true);

void setup() {
  Serial.begin(115200);

  buttonCfg->configureAsConfigButton(&SuplaDevice);

  // HTML www component
  new Supla::Html::DeviceInfo(&SuplaDevice);
  new Supla::Html::WifiParameters;
  new Supla::Html::ProtocolParameters;
  new Supla::Html::StatusLedParameters;

  SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
  SuplaDevice.begin();
}

void loop() {
  SuplaDevice.iterate();
}
Przenieś tworzenie button do setup I wrzuć PR
Najlepsze suple dla Twojego domu :mrgreen:
Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Cześć.
Bawię się właśnie czujnikiem SCD41 i widzę że dla CO2 historia wyników jest zablokowana.
Czy da się aktywować historię, albo czy są plany, żeby to było aktywne domyślnie?
User avatar
klew
Posts: 13905
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Marian1544 wrote: Thu Jan 22, 2026 3:53 pm Cześć.
Bawię się właśnie czujnikiem SCD41 i widzę że dla CO2 historia wyników jest zablokowana.
Czy da się aktywować historię, albo czy są plany, żeby to było aktywne domyślnie?
Na jakim kanale masz CO2 zrobione?
Jeśli na kpop to w cloud możesz sobie włączyć historię
Najlepsze suple dla Twojego domu :mrgreen:
Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Na tą chwilę czujnik jest dodany chyba w najprostszy możliwy sposób, czyli:

Code: Select all

Wire.begin(SDA_PIN, SCL_PIN);
  new Supla::Html::I2Cscanner();
  auto scd4x = new Supla::Sensor::SCD4x();
Nie wiem czy to kpop, ale rzeczywiście da się włączyć historię w Cloud.
Dzięki za info.
User avatar
malarz
Posts: 506
Joined: Wed Jan 27, 2021 4:04 pm
Been thanked: 2 times

Post

Marian1544 wrote: Thu Jan 22, 2026 5:14 pm Na tą chwilę czujnik jest dodany chyba w najprostszy możliwy sposób, czyli:

Code: Select all

Wire.begin(SDA_PIN, SCL_PIN);
  new Supla::Html::I2Cscanner();
  auto scd4x = new Supla::Sensor::SCD4x();
Nie wiem czy to kpop, ale rzeczywiście da się włączyć historię w Cloud.
Dzięki za info.
Tak, to KPOP. Fajnie, że ktoś korzysta z tej klasy :-)
Próbuję przerobić pomysły na działające projekty w ArduinoIDE.
Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Jak aktualnie wyglada wyciąganie danych na potrzeb lokalne danego urządzenia (LCD itp.)?
W jakiejś starszej wersji dla DHT działało mi coś takiego:

Code: Select all

Supla::Sensor::SCD4x *scd4x = nullptr;
 
auto scd4x = new Supla::Sensor::SCD4x();
A w pętli głównej:

Code: Select all

if (millis() - lastRead > 5000) {
    lastRead = millis();
    printf("TestBuffer: %d \n", scd4x->getChannel()->getValueDouble());
  }
Ale wyglada że ESP8266 się od tego resetuje.
Gdzie szukać info na co wskazują te wskaźniki typu: getChannel()->getValueDoubleFirst()

Return to “supla-dev”