Wyświetlanie na wyświetlaczu TFT - 8 wartości DS-ów

Masz pomysł na funkcjonalność lub koncepcję na rozwój projektu. Opisz wszystko tutaj.
mirizag
Posty: 121
Rejestracja: pn sty 02, 2017 6:36 pm

BL do 3,3V nie miałem podpięte, ale dzisiaj podałem 3,3V ale żadnej różnicy.
Załączniki
tft1.jpg
tft1.jpg (5.43 MiB) Przejrzano 3540 razy
tft.jpg
tft.jpg (5.47 MiB) Przejrzano 3540 razy
piomar2
Posty: 369
Rejestracja: pt kwie 26, 2019 5:32 pm
Lokalizacja: Bukowice

Jak nie miałeś podłączonego BL do 3v3 to ekran powinien być zupełnie ciemny. Ja (dla próby) dałem potencjometr 220 om między masę a +3V3 a środek dałem na BL. Jasność reguluje się bardzo dobrze. Trochę dziwne, że u Ciebie nie ma żadnej różnicy przy połączeniu BL lub bez. Może u Ciebie BL wymaga +5V (to jest podświetlenie diodami). Dałbym potecjometr na 5V i ostrożnie (regulując od masy) sprawdziłbym.

2.jpg
2.jpg (420.59 KiB) Przejrzano 3535 razy
1.jpg
1.jpg (294.31 KiB) Przejrzano 3535 razy
mirizag
Posty: 121
Rejestracja: pn sty 02, 2017 6:36 pm

Już jest dobrze przepiąłem VCC wyświetlacza pod inne wyjście 3,3V w Nodemcu i jest dobrze. Tamto poprzednie wyjście dawało niecałe 2V. A mam jeszcze pytanie czy można usunąć z listy wyświetlania pozostałe nie używane pozycje i zwiększyć czcionkę.
I jeszcze jedną rzecz zauważyłem nie wiem czy to tylko u mnie ale kiedy zwieram D1 do masy na 15sek wchodzę w konfigurację dopisuję np. jeszcze jedną pozycję daje na Save moduł po chwili się restartuje, ale zmian nie wprowadza.
A tą obudowę od czego zastosowałeś bo szukam jakiejś obudowy zgrabnej, ale nie mogę namierzyć.
piomar2
Posty: 369
Rejestracja: pt kwie 26, 2019 5:32 pm
Lokalizacja: Bukowice

Na D1 jest wejście do ustawień: "#define Config_PIN 5 //D1 // wifi config". Aby zapamiętać zmiany trzeba jeszcze raz w configu zatwierdzić wifi i hasło do wifi (przy każdej zmianie) - wtedy pamięta zmiany. Co do reszty to pisanie "prawie od nowa". Podałem kod źródłowy to można poćwiczyć...
Obudowa to kupiona kiedyś na alle a np. tu do wyboru do koloru:
https://allegro.pl/uzytkownik/lisiu?str ... e-1-4-0318
mirizag
Posty: 121
Rejestracja: pn sty 02, 2017 6:36 pm

A jeszcze jedno pytanko bo chciałbym aby wyświetlało mi poziom w zbiorniku szamba utworzyłem link ale nie wyświetla. Czy trzeba zmienić coś w kodzie aby wyświetlało.
piomar2
Posty: 369
Rejestracja: pt kwie 26, 2019 5:32 pm
Lokalizacja: Bukowice

Przecież poziom w zbiorniku szamba to nie temperatura!!!
mihu
Posty: 159
Rejestracja: śr lut 28, 2018 6:00 pm

a jak zrobiłeś pomiar akumulatorów , jest jakiś soft do pomiaru aku?i sprzęt?
piomar2
Posty: 369
Rejestracja: pt kwie 26, 2019 5:32 pm
Lokalizacja: Bukowice

wandre
Posty: 28
Rejestracja: wt lut 04, 2020 8:49 pm

piomar2 pisze: ndz mar 29, 2020 2:48 pm Witam!
Zmęczony częstym zaglądaniem do clouda w kompie albo na telefonie w celu kontroli temperatur i napięcia na akumulatorach skleciłem program, który wyświetla na wyświetlaczu TFT - ST7735 jednocześnie 8 wartości z różnych DS-ów zamontowanych w domu.

Kolejność jest następująca:

- odpalamy swojego clouda i robimy linki bezpośrednie (read) z DS-ów, które nas interesują i zapisujemy je,
- czyścimy wemosa,
- wgrywamy przy ustawieniach DOUT i 32Mbit lub kompilujemy źródło i wgrywamy przez arduino,
- resetujemy wemosa i podłączamy się do wifi " Dir_8_TFT",
- wypełniamy tabelkę configu (na opisy DS-ów mamy po 15 znaków)
- zapisujemy i czekamy aż komp wróci sam do swojego wifi,
- w cloudzie nic się nie pojawia, a dane wyświetlają się na wyświetlaczu
- pierwsza wartość wyświetli się po upływie około 15 - 20 sek (czyli odświeżanie trwa około 2,5 minuty),
- chcesz dokonać zmiany to zwierając na 15 sek D1 do masy wchodzimy ponownie do configu i dopisujemy jeszcze raz swoje wifi, hasło do niego i zmieniamy co tam chcemy.

I to FINAŁ. Możemy cieszyć się nowym gadżetem.


8xDS.jpg
wyśw.jpg

Kod: Zaznacz cały

//wifi Dir_8_TFT
//Ustawienie 192.168.4.1
//linki read z dowolnych 8 DS-ow w cloudzie
//Config - D1 20sek

/*EKRAN> ST7735 o przekatnej 1,8 cala 
RST   D4 
CS    D3 
DC    D2
CLK   D5
DIN   D7

Wemos mini
 */

#include <FS.h>               // ---- esp board manager 2.4.2 
#include <WiFiClientSecure.h>
#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <WiFiManager.h>     //- https://github.com/tzapu/WiFiManager/tree/0.14 ----------
#include <ArduinoJson.h>     //--https://github.com/bblanchon/ArduinoJson/tree/v5.13.2 ---

#include <Adafruit_GFX.h>     // include Adafruit graphics library
#include <Adafruit_ST7735.h>  // include Adafruit ST7735 TFT library
 
const char* host = "svr.supla.org";
const int httpsPort = 443;

char Supla_server[41];
char name_1[16];
char name_2[16];
char name_3[16];
char name_4[16];
char name_5[16];
char name_6[16];
char name_7[16];
char name_8[16];

char D_Link_1[50];//61
char D_Link_2[50];
char D_Link_3[50];
char D_Link_4[50];
char D_Link_5[50];
char D_Link_6[50];
char D_Link_7[50];
char D_Link_8[50];

byte mac[6];
String url = "/direct/xx/xxxxxxxxx/xxx";
bool dimm = false;         
unsigned long dimm_milis ;
int C_W_state = HIGH;            
int last_C_W_state = HIGH;       
unsigned long time_last_C_W_change = 0;   
long C_W_delay = 10000;           // 10 sekund
bool shouldSaveConfig = false;
bool initialConfig = false;
unsigned long link_delay = 2000; //4000
#define onboard_led 2    //D4  
#define Config_PIN 5     //D1    // wifi config
int timeout   = 120; // seconds to run for wifi Manager

float temp1;
float temp2;
float temp3;
float temp4;
float temp5;
float temp6;
float temp7;
float temp8;
int C_W_read;


#define TFT_RST   D4   
#define TFT_CS    D3   
#define TFT_DC    D2   
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

static const unsigned char PROGMEM logo32_glcd_bmp[] =
{
  0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00,
  0x0e, 0x0e, 0x00, 0x00, 0x0c, 0x06, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00,
  0x1c, 0x03, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x00, 0x0e, 0x0f, 0x80, 0x00, 0x07, 0xfc, 0xe0, 0x00,
  0x03, 0xf8, 0x30, 0x00, 0x00, 0xf0, 0x0d, 0xe0, 0x00, 0x10, 0x07, 0x30, 0x00, 0x18, 0x02, 0x10,
  0x00, 0x18, 0x06, 0x18, 0x00, 0x08, 0x02, 0x10, 0x00, 0x08, 0x03, 0xf0, 0x00, 0x0c, 0x07, 0xc0,
  0x00, 0x04, 0x0c, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00,
  0x00, 0x03, 0xc0, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x0c, 0x20, 0x00,
  0x00, 0x04, 0x40, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 
void saveConfigCallback () {
  Serial.println("Should save config");
  shouldSaveConfig = true;
}
//---------------------------------------
void ondemandwifiCallback () {
 
  WiFiManagerParameter custom_Supla_server("server", "supla server", Supla_server, 41);
  
  WiFiManagerParameter custom_name_1("name_1", "Nazwa_1", name_1, 16);
  WiFiManagerParameter custom_D_Link_1("Linka", "Link_z_1_DS18B20_read", D_Link_1, 50);
  WiFiManagerParameter custom_name_2("name_2", "Nazwa_2", name_2, 16);
  WiFiManagerParameter custom_D_Link_2("Linkb", "Link_z_2_DS18B20_read", D_Link_2, 50);
  WiFiManagerParameter custom_name_3("name_3", "Nazwa_3", name_3, 16);
  WiFiManagerParameter custom_D_Link_3("Linkc", "Link_z_3_DS18B20_read", D_Link_3, 50);
  WiFiManagerParameter custom_name_4("name_4", "Nazwa_4", name_4, 16);
  WiFiManagerParameter custom_D_Link_4("Linkd", "Link_z_4_DS18B20_read", D_Link_4, 50);
  
  WiFiManagerParameter custom_name_5("name_5", "Nazwa_5", name_5, 16);
  WiFiManagerParameter custom_D_Link_5("Linke", "Link_z_5_DS18B20_read", D_Link_5, 50);
  WiFiManagerParameter custom_name_6("name_6", "Nazwa_6", name_6, 16);
  WiFiManagerParameter custom_D_Link_6("Linkf", "Link_z_6_DS18B20_read", D_Link_6, 50);
  WiFiManagerParameter custom_name_7("name_7", "Nazwa_7", name_7, 16);
  WiFiManagerParameter custom_D_Link_7("Linkg", "Link_z_7_DS18B20_read", D_Link_7, 50);
  WiFiManagerParameter custom_name_8("name_8", "Nazwa_8", name_8, 16);
  WiFiManagerParameter custom_D_Link_8("Linkh", "Link_z_8_DS18B20_read", D_Link_8, 50);
  


  WiFiManager wifiManager;
  wifiManager.setBreakAfterConfig(true);
  wifiManager.setSaveConfigCallback(saveConfigCallback);
  
  wifiManager.addParameter(&custom_Supla_server);
  
   wifiManager.addParameter(&custom_name_1);
  wifiManager.addParameter(&custom_D_Link_1);
   wifiManager.addParameter(&custom_name_2);
  wifiManager.addParameter(&custom_D_Link_2);
   wifiManager.addParameter(&custom_name_3);
  wifiManager.addParameter(&custom_D_Link_3);
   wifiManager.addParameter(&custom_name_4);
  wifiManager.addParameter(&custom_D_Link_4);

  wifiManager.addParameter(&custom_name_5);
  wifiManager.addParameter(&custom_D_Link_5);
   wifiManager.addParameter(&custom_name_6);
  wifiManager.addParameter(&custom_D_Link_6);
   wifiManager.addParameter(&custom_name_7);
  wifiManager.addParameter(&custom_D_Link_7);
   wifiManager.addParameter(&custom_name_8);
  wifiManager.addParameter(&custom_D_Link_8);
 
  wifiManager.setCustomHeadElement("<style>html{ background-color: #01DF3A;}</style><div class='s'><svg version='1.1' id='l' x='0' y='0' viewBox='0 0 200 200' xml:space='preserve'><path d='M59.3,2.5c18.1,0.6,31.8,8,40.2,23.5c3.1,5.7,4.3,11.9,4.1,18.3c-0.1,3.6-0.7,7.1-1.9,10.6c-0.2,0.7-0.1,1.1,0.6,1.5c12.8,7.7,25.5,15.4,38.3,23c2.9,1.7,5.8,3.4,8.7,5.3c1,0.6,1.6,0.6,2.5-0.1c4.5-3.6,9.8-5.3,15.7-5.4c12.5-0.1,22.9,7.9,25.2,19c1.9,9.2-2.9,19.2-11.8,23.9c-8.4,4.5-16.9,4.5-25.5,0.2c-0.7-0.3-1-0.2-1.5,0.3c-4.8,4.9-9.7,9.8-14.5,14.6c-5.3,5.3-10.6,10.7-15.9,16c-1.8,1.8-3.6,3.7-5.4,5.4c-0.7,0.6-0.6,1,0,1.6c3.6,3.4,5.8,7.5,6.2,12.2c0.7,7.7-2.2,14-8.8,18.5c-12.3,8.6-30.3,3.5-35-10.4c-2.8-8.4,0.6-17.7,8.6-22.8c0.9-0.6,1.1-1,0.8-2c-2-6.2-4.4-12.4-6.6-18.6c-6.3-17.6-12.7-35.1-19-52.7c-0.2-0.7-0.5-1-1.4-0.9c-12.5,0.7-23.6-2.6-33-10.4c-8-6.6-12.9-15-14.2-25c-1.5-11.5,1.7-21.9,9.6-30.7C32.5,8.9,42.2,4.2,53.7,2.7c0.7-0.1,1.5-0.2,2.2-0.2C57,2.4,58.2,2.5,59.3,2.5z M76.5,81c0,0.1,0.1,0.3,0.1,0.6c1.6,6.3,3.2,12.6,4.7,18.9c4.5,17.7,8.9,35.5,13.3,53.2c0.2,0.9,0.6,1.1,1.6,0.9c5.4-1.2,10.7-0.8,15.7,1.6c0.8,0.4,1.2,0.3,1.7-0.4c11.2-12.9,22.5-25.7,33.4-38.7c0.5-0.6,0.4-1,0-1.6c-5.6-7.9-6.1-16.1-1.3-24.5c0.5-0.8,0.3-1.1-0.5-1.6c-9.1-4.7-18.1-9.3-27.2-14c-6.8-3.5-13.5-7-20.3-10.5c-0.7-0.4-1.1-0.3-1.6,0.4c-1.3,1.8-2.7,3.5-4.3,5.1c-4.2,4.2-9.1,7.4-14.7,9.7C76.9,80.3,76.4,80.3,76.5,81z M89,42.6c0.1-2.5-0.4-5.4-1.5-8.1C83,23.1,74.2,16.9,61.7,15.8c-10-0.9-18.6,2.4-25.3,9.7c-8.4,9-9.3,22.4-2.2,32.4c6.8,9.6,19.1,14.2,31.4,11.9C79.2,67.1,89,55.9,89,42.6z M102.1,188.6c0.6,0.1,1.5-0.1,2.4-0.2c9.5-1.4,15.3-10.9,11.6-19.2c-2.6-5.9-9.4-9.6-16.8-8.6c-8.3,1.2-14.1,8.9-12.4,16.6C88.2,183.9,94.4,188.6,102.1,188.6z M167.7,88.5c-1,0-2.1,0.1-3.1,0.3c-9,1.7-14.2,10.6-10.8,18.6c2.9,6.8,11.4,10.3,19,7.8c7.1-2.3,11.1-9.1,9.6-15.9C180.9,93,174.8,88.5,167.7,88.5z'/></svg>");

  wifiManager.setMinimumSignalQuality();
    wifiManager.setConfigPortalTimeout(timeout);

    if (!wifiManager.startConfigPortal("Dir_8_TFT")) {
      Serial.println("failed to connect and hit timeout");
      delay(2000);
      ESP.restart();
      delay(4000);
    }
    Serial.println("connected...yeey :)");

    strcpy(Supla_server, custom_Supla_server.getValue());
    
     strcpy(name_1, custom_name_1.getValue());
    strcpy(D_Link_1, custom_D_Link_1.getValue());
     strcpy(name_2, custom_name_2.getValue());
    strcpy(D_Link_2, custom_D_Link_2.getValue());
     strcpy(name_3, custom_name_3.getValue());
    strcpy(D_Link_3, custom_D_Link_3.getValue());
     strcpy(name_4, custom_name_4.getValue());
    strcpy(D_Link_4, custom_D_Link_4.getValue());

     strcpy(name_5, custom_name_5.getValue());
    strcpy(D_Link_5, custom_D_Link_5.getValue());
     strcpy(name_6, custom_name_6.getValue());
    strcpy(D_Link_6, custom_D_Link_6.getValue());
     strcpy(name_7, custom_name_7.getValue());
    strcpy(D_Link_7, custom_D_Link_7.getValue());
     strcpy(name_8, custom_name_8.getValue());
    strcpy(D_Link_8, custom_D_Link_8.getValue());
    
}
ICACHE_RAM_ATTR void no_dimm(){
            dimm_milis = millis() + 30000 ;
                dimm = false; 
}
//***********   Setup  *******************
void setup() { 

  Serial.begin(115200);
  
  tft.initR(INITR_BLACKTAB);     
  tft.fillScreen(ST7735_BLACK); 

 //tft.setRotation(2); 

  tft.drawBitmap(12,4,logo32_glcd_bmp, 32, 32, ST7735_GREEN);  
   
  tft.drawFastHLine(0, 40,  tft.width(), ST7735_BLUE);
   tft.drawFastHLine(0, 44,  tft.width(), ST7735_BLUE);
   tft.drawFastHLine(0, 140,  tft.width(), ST7735_BLUE);
   tft.drawFastHLine(0, 144,  tft.width(), ST7735_BLUE);
  tft.setTextSize(1);     
  tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
  tft.setCursor(56, 22);  
  tft.print("Temperatury");  

  pinMode(Config_PIN, INPUT_PULLUP);
  pinMode(onboard_led, OUTPUT);
 
 tft.setTextColor(ST7735_ORANGE, ST7735_BLACK);
  tft.setCursor(80, 8);
 tft.print("WiFi_no");
  if (WiFi.SSID()==""){   
    initialConfig = true;
 }
 tft.setCursor(80, 8);
 tft.print("WiFi_ok");
  Serial.println("mounting FS..."); 
  if (SPIFFS.begin()) {
    Serial.println("mounted file system");
    if (SPIFFS.exists("/config.json")) {
      //file exists, reading and loading
      Serial.println("reading config file");
      File configFile = SPIFFS.open("/config.json", "r");
      if (configFile) {
        Serial.println("opened config file");
        size_t size = configFile.size();
        std::unique_ptr<char[]> buf(new char[size]);
        configFile.readBytes(buf.get(), size);
        DynamicJsonBuffer jsonBuffer;         
        JsonObject& json = jsonBuffer.parseObject(buf.get());
        Serial.println(jsonBuffer.size());
        json.printTo(Serial);
        if (json.success()) {
          Serial.println("\nparsed json");
          strcpy(Supla_server, json["Supla_server"]);
          
           strcpy(name_1, json["nazwa_1"]);  
          strcpy(D_Link_1, json["D_Link_1"]);
           strcpy(name_2, json["nazwa_2"]);  
          strcpy(D_Link_2, json["D_Link_2"]);
           strcpy(name_3, json["nazwa_3"]);  
          strcpy(D_Link_3, json["D_Link_3"]);
           strcpy(name_4, json["nazwa_4"]);  
          strcpy(D_Link_4, json["D_Link_4"]);

          strcpy(name_5, json["nazwa_5"]);  
          strcpy(D_Link_5, json["D_Link_5"]);
         strcpy(name_6, json["nazwa_6"]); 
          strcpy(D_Link_6, json["D_Link_6"]);
           strcpy(name_7, json["nazwa_7"]);  
          strcpy(D_Link_7, json["D_Link_7"]);
           strcpy(name_8, json["nazwa_8"]);  
          strcpy(D_Link_8, json["D_Link_8"]);
           
        } else {
          Serial.println("failed to load json config");          
        }
      }
    }
  } else {
    Serial.println("failed to mount FS");
 } 
 display_tft();
}
//*************   loop  *******************
void loop() { 

   if (initialConfig){ondemandwifiCallback();initialConfig = false;}
   
  if (millis() > dimm_milis){ 
    if (dimm == false){
   
    dimm = true ;     
    }    
    dimm_milis = millis() + 3000 ;
     } 
       
    if ((WiFi.status() == WL_CONNECTED) && (millis() > link_delay)){

       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(1);
       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(2);
       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(3);
       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(4);

       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(5);
       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(6);
       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(7);
       C_W_read = digitalRead(Config_PIN);{configer();}
       direct_Link(8);
       }
  
  if (shouldSaveConfig) {
    Serial.println("saving config");
    
    DynamicJsonBuffer jsonBuffer;
    JsonObject& json = jsonBuffer.createObject();
    json["Supla_server"] = Supla_server;
    
     json["nazwa_1"] = name_1;
    json["D_Link_1"] = D_Link_1;
     json["nazwa_2"] = name_2;
    json["D_Link_2"] = D_Link_2;
     json["nazwa_3"] = name_3;
    json["D_Link_3"] = D_Link_3;
     json["nazwa_4"] = name_4;
    json["D_Link_4"] = D_Link_4;

     json["nazwa_5"] = name_5;
    json["D_Link_5"] = D_Link_5;
     json["nazwa_6"] = name_6;
    json["D_Link_6"] = D_Link_6;
     json["nazwa_7"] = name_7;
    json["D_Link_7"] = D_Link_7;
     json["nazwa_8"] = name_8;
    json["D_Link_8"] = D_Link_8;
    
    
    File configFile = SPIFFS.open("/config.json", "w");
    if (!configFile) {
      Serial.println("failed to open config file for writing");
    }
    json.prettyPrintTo(Serial);
    json.printTo(configFile);
    configFile.close();
    Serial.println("config saved");
   
    shouldSaveConfig = false;
    WiFi.mode(WIFI_STA);
    digitalWrite(onboard_led, HIGH);
    ESP.restart();
      delay(3000); 
 }
  
  if (WiFi.status() != WL_CONNECTED) {
      WiFi_up();
 }
}
//---------------------------------------
void WiFi_up() {
  WiFi.begin(); 
  
  for (int x = 20; x > 0; x--) 
  {
    if (WiFi.status() == WL_CONNECTED) 
    {
      break;                           
    }
    else                                 
    {
      Serial.print(".");                
      delay(500);                      
    }
  }
}
//---------------------------------------
void direct_Link(int link_num) {
        host = Supla_server;
        String url = "";
        
           if (link_num == 1){ url = D_Link_1;}
      else if (link_num == 2){ url = D_Link_2;}
       else if (link_num == 3){ url = D_Link_3;}
        else if (link_num == 4){ url = D_Link_4;}
         else if (link_num == 5){ url = D_Link_5;}
          else if (link_num == 6){ url = D_Link_6;}
           else if (link_num == 7){ url = D_Link_7;}
            else if (link_num == 8){ url = D_Link_8;}
            

      else{return;}

  WiFiClientSecure client;
  Serial.print("connecting to ");
  Serial.println(host);
  if (!client.connect(host, httpsPort)) {
    Serial.println("connection failed ------");
    return;
  }
  Serial.print("requesting URL: ");
  Serial.println(url);
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "User-Agent: ESP8266\r\n" +
               "Connection: close\r\n\r\n");
  Serial.println("request sent");
  while (client.connected()) {
    String line = client.readStringUntil('\n');
    if (line == "\r") {
      Serial.println("headers received");
      break;
    }
  }
   String line = client.readStringUntil('\n');
  if (line.indexOf("true") >0) {
    yield();
  Serial.println("reply was:  ");Serial.println("==========");  
 
  Serial.println(line);

  Serial.println("==========");Serial.println("closing connection");
    DynamicJsonBuffer jsonBuffer;
  JsonObject& root = jsonBuffer.parseObject(line);
  
 //----T1----
  if (link_num == 1){
  temp1 = root["temperature"]; 
  Serial.println (temp1);}
  display_tft();

//----T2----
  if (link_num == 2){
  temp2 = root["temperature"]; 
  Serial.println (temp2);}
  display_tft();

//----T3----
  if (link_num == 3){
  temp3 = root["temperature"]; 
  Serial.println (temp3);}
  display_tft();

//----T4----
  if (link_num == 4){
  temp4 = root["temperature"]; 
  Serial.println (temp4);}
  display_tft();

 //----T5----
  if (link_num == 5){
  temp5 = root["temperature"]; 
  Serial.println (temp5);}
  display_tft();

  //----T6----
  if (link_num == 6){
  temp6 = root["temperature"]; 
  Serial.println (temp6);}
  display_tft();

  //----T7----
  if (link_num == 7){
  temp7 = root["temperature"]; 
  Serial.println (temp7);}
  display_tft();

  //----T8----
  if (link_num == 8){
  temp8 = root["temperature"]; 
  Serial.println (temp8);}
  display_tft();
 
 digitalWrite(onboard_led, HIGH);
   } 
}

//---------------------------------------
void display_tft()
{
 tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);  
  
  tft.setCursor(6, 55);   
  tft.print(name_1);
  tft.setCursor(93, 55);   
   tft.print(temp1);
     
   tft.setCursor(6, 65);   
  tft.print(name_2);
  tft.setCursor(93, 65);  
   tft.print(temp2);

    tft.setCursor(6, 75);   
  tft.print(name_3);
  tft.setCursor(93, 75); 
   tft.print(temp3);

   tft.setCursor(6, 85);   
  tft.print(name_4);
  tft.setCursor(93, 85);  
   tft.print(temp4);

   tft.setCursor(6, 95);   
  tft.print(name_5);
  tft.setCursor(93, 95);  
   tft.print(temp5);

    tft.setCursor(6, 105);   
  tft.print(name_6);
  tft.setCursor(93, 105);  
   tft.print(temp6);

    tft.setCursor(6, 115);   
  tft.print(name_7);
  tft.setCursor(93, 115);  
   tft.print(temp7);

    tft.setCursor(6, 125);   
  tft.print(name_8);
  tft.setCursor(93, 125);  
   tft.print(temp8);
}
//----------------------------------------------------
void configer(){
if (C_W_read != last_C_W_state) {            
     time_last_C_W_change = millis();    
   }
   if ((millis() - time_last_C_W_change) > C_W_delay) {     
     if (C_W_read != C_W_state) {     
       Serial.println("Triger sate changed");
       C_W_state = C_W_read;       
       if (C_W_state == LOW) {
        ondemandwifiCallback () ;
       }
     }
    }
   last_C_W_state = C_W_read;        
}

Witam. Próbuję przerobić twój kod pod inny wyświetlacz, który aktualnie posiadam, ale mam problem z odbiorem temperatur.
Mam pytanie, czy w tabelce configu nalerzy wkopiować pełny link (read), bo jak copiuje https://svr7.supla.org/direct/xxx/xxxxxxxxxxxxxxx/read to się nie mieści cały. Jeżeli pominę https:// to nie odbiera temperatur.
Generalnie na porcie RS232 mam taki komunikat:

connecting to srv7.supla.org
requesting URL: srv7.supla.org/direct/xxxx/xxxxxxxxxxxxxxx/read
request sent
headers received

po kolei do wszystkich linków.
wandre
6x Sonoff Basic, 3x Sonoff Pow_R2, 1x ESP12, 3x Wemos d1 mini
piomar2
Posty: 369
Rejestracja: pt kwie 26, 2019 5:32 pm
Lokalizacja: Bukowice

Należy kopiować:
/direct/xxx/xxxxxxxxx/read
ODPOWIEDZ

Wróć do „Pomysły i koncepcje”