IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Arduino Discussion :

Lilygo TDisplay-S3 : Problème de GPIO


Sujet :

Arduino

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé
    Inscrit en
    Juillet 2004
    Messages
    936
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 936
    Par défaut Lilygo TDisplay-S3 : Problème de GPIO
    Bonjour à Tous,

    Mon problème du jour vient de ce message :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    ESP-ROM:esp32s3-20210327
    Build:Mar 27 2021
    rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
    Saved PC:0x420939c6
    SPIWP:0xee
    mode:DIO, clock div:1
    load:0x3fce3808,len:0x44c
    load:0x403c9700,len:0xbe4
    load:0x403cc700,len:0x2a38
    entry 0x403c98d4
    E (15) gpio: gpio_set_level(226): GPIO output gpio_num error  <==============
    E (16) gpio: gpio_set_level(226): GPIO output gpio_num error  <==============
    j'en est déduis qu'il y a une incomparabilité sur l'emploi des sorties ou entrées du module ( utilisées pour modifier l'éclairage)
    le programme se compile sans problème, se lance , affiche les datas mais il reste figer !
    l'ennui est que j'ai neutralisé l'ensemble des appels à ses boutons mais le programme plante toujours (?)

    Je souhaiterai donc svp connaître avec votre aide la signification du blocage car je ne vois pas son origine

    Merci encore


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
     
    #include "ani.h"
    #include <SPI.h>
    #include <WiFi.h>
    #include <TFT_eSPI.h> // Hardware-specific library
    #include <ArduinoJson.h>          //https://github.com/bblanchon/ArduinoJson.git
    #include <NTPClient.h>           //https://github.com/taranais/NTPClient
    #include "settings.h"
    #include <WiFiUdp.h>
    #include <HTTPClient.h>
     
    TFT_eSPI tft = TFT_eSPI();       // Invoke custom library
     
    #define TFT_GREY 0x5AEB
    #define lightblue 0x01E9
    #define darkred 0xA041
    #define blue 0x5D9B
    #include "Orbitron_Medium_20.h"
     
     
     
    const int pwmFreq = 5000;
    const int pwmResolution = 8;
    const int pwmLedChannelTFT = 0;
     
    const char* SSID     = WIFI_SSID;      
    const char* PASSWORD = WIFI_PASS; 
    String town="xxxxxxx";              
    String Country="FR";                
    const String endpoint = "http://api.openweathermap.org/data/2.5/weather?q="+town+","+Country+"&units=metric&APPID=";
    const String key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
     
    String payload=""; //whole json 
    String tmp="" ; //temperatur
    String hum="" ; //humidity
     
     
    StaticJsonDocument<1000> doc;
     
    // Define NTP Client to get time
    WiFiUDP ntpUDP;
    NTPClient timeClient(ntpUDP);
     
    // Variables to save date and time
    String formattedDate;
    String dayStamp;
    String timeStamp;
     
    int backlight[5] = {10,30,60,120,220};
    byte b=1;
     
     
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // setup().
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    void setup() {
      //pinMode(0,INPUT);           // <==================== 
      //pinMode(14,INPUT);         // <====================
      pinMode(PIN_POWER_ON, OUTPUT);
      digitalWrite(PIN_POWER_ON, HIGH);
     
      tft.init();
      tft.setRotation(0);
      tft.fillScreen(TFT_BLACK);
      tft.setTextColor(TFT_WHITE,TFT_BLACK);  tft.setTextSize(1);
     
      ledcSetup(pwmLedChannelTFT, pwmFreq, pwmResolution);
      ledcAttachPin(TFT_BL, pwmLedChannelTFT);
      ledcWrite(pwmLedChannelTFT, backlight[b]);
     
      // Wait for a connection.
      initwifi();  
      tft.println(WiFi.localIP());
      delay(3000);
      tft.setTextColor(TFT_WHITE,TFT_BLACK);  tft.setTextSize(1);
      tft.fillScreen(TFT_BLACK);
      tft.setSwapBytes(true);
      tft.setCursor(2, 232, 1);
      tft.println(WiFi.localIP());
      tft.setCursor(80, 204, 1);
      tft.println("BRIGHT:");
      tft.setCursor(80, 152, 2);
      tft.println("SEC:");
      tft.setTextColor(TFT_WHITE,lightblue);
      tft.setCursor(4, 152, 2);
      tft.println("TEMP:");
      tft.setCursor(4, 192, 2);
      tft.println("HUM: ");
      tft.setTextColor(TFT_WHITE,TFT_BLACK);
      tft.setFreeFont(&Orbitron_Medium_20);
      tft.setCursor(6, 82);
      tft.println(town);
      tft.fillRect(68,152,1,74,TFT_GREY);
      for(int i=0;i<b+1;i++)
      tft.fillRect(78+(i*7),216,3,10,blue);
     
    // Initialize a NTPClient to get time
      timeClient.begin(); 
      timeClient.setTimeOffset(7200);   /*EDDITTTTTTTTTTTTTTTTTTTTTTTT                      */
      getData();
      delay(500);
    }
     
     
    int i=0;
    String tt="";
    int count=0;
    bool inv=1;
    int press1=0; 
    int press2=0;////
    int frame=0;
    String curSeconds="";
     
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // loop().
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void loop() {
      tft.pushImage(0, 88,  135, 65, ani[frame]);
      frame++;
      if(frame>=10)
      frame=0;
      /*   
      if(digitalRead(14)==0){
        if(press2==0)
          {
          press2=1;
          tft.fillRect(78,216,44,12,TFT_BLACK);
          b++;
          if(b>=5)
            b=0;
            for(int i=0;i<b+1;i++)
            tft.fillRect(78+(i*7),216,3,10,blue);
            ledcWrite(pwmLedChannelTFT, backlight[b]);
          }
       } else press2=0;
     
      if(digitalRead(0)==0){
        if(press1==0) {
    		press1=1;
            inv=!inv;
            tft.invertDisplay(inv);
    	}
       }else press1=0;
      */   
          if(count==0) 
            getData();
            count++;
     
          if(count>2000)
            count=0;
            tft.setFreeFont(&Orbitron_Medium_20);
            tft.setCursor(2, 187);
            tft.println(tmp.substring(0,3));
            tft.setCursor(2, 227);
            tft.println(hum+"%");
            tft.setTextColor(TFT_ORANGE,TFT_BLACK);
            tft.setTextFont(2);
            tft.setCursor(6, 44);
            tft.println(dayStamp);
            tft.setTextColor(TFT_WHITE,TFT_BLACK);
            while(!timeClient.update()) {
              timeClient.forceUpdate();
            }
     
            // The formattedDate comes with the following format:
            // 2018-05-28T16:00:13Z
            // We need to extract date and time
            formattedDate = timeClient.getFormattedTime();
            Serial.println(formattedDate);
            int splitT = formattedDate.indexOf("T");
            dayStamp = formattedDate.substring(0, splitT);
            timeStamp = formattedDate.substring(splitT+1, formattedDate.length()-1);
     
            if(curSeconds!=timeStamp.substring(6,8)){
             tft.fillRect(78,170,48,28,darkred);
             tft.setFreeFont(&Orbitron_Light_24);
             tft.setCursor(81, 192);
             tft.println(timeStamp.substring(6,8));
             curSeconds=timeStamp.substring(6,8);
            }
     
            tft.setFreeFont(&Orbitron_Light_32);
            String current=timeStamp.substring(0,5);
            if(current!=tt)
            {
              tft.fillRect(3,8,120,30,TFT_BLACK);
              tft.setCursor(5, 34);
              tft.println(timeStamp.substring(0,5));
              tt=timeStamp.substring(0,5);
            }
     
     
      delay(80);
    }
     
     
    void getData()
    {
        tft.fillRect(1,170,64,20,TFT_BLACK);
        tft.fillRect(1,210,64,20,TFT_BLACK);
       if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
     
        HTTPClient http;
     
        http.begin(endpoint + key); //Specify the URL
        int httpCode = http.GET();  //Make the request
     
        if (httpCode > 0) { //Check for the returning code
     
             payload = http.getString();
           // Serial.println(httpCode);
            Serial.println(payload);
     
          }
     
        else {
          Serial.println("Error on HTTP request");
        }
     
        http.end(); //Free the resources
      }
     char inp[1000];
     payload.toCharArray(inp,1000);
     deserializeJson(doc,inp);
     
      String tmp2 = doc["main"]["temp"];
      String hum2 = doc["main"]["humidity"];
      String town2 = doc["name"];
      tmp=tmp2;
      hum=hum2;
     
       Serial.println("Temperature"+String(tmp));
       Serial.println("Humidity"+hum);
       Serial.println(town);
     
     }
     
    void initwifi() {
      WiFi.disconnect();
      WiFi.softAPdisconnect(true);
      WiFi.mode(WIFI_STA);
      WiFi.begin(SSID, PASSWORD);
     
      int i = 0;
      while (WiFi.status() != WL_CONNECTED) {
        Serial.print("STATUS(Connecting to WiFi) ");
        delay(1000);
        i = i + 1;
        if (i > 10) {
          ESP.restart();
        }
      }
      Serial.println("OK");
    }

  2. #2
    Expert confirmé

    Homme Profil pro
    mad scientist :)
    Inscrit en
    Septembre 2019
    Messages
    2 887
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : mad scientist :)

    Informations forums :
    Inscription : Septembre 2019
    Messages : 2 887
    Par défaut
    le message d'erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    E (15) gpio: gpio_set_level(226): GPIO output gpio_num error  <==============
    E (16) gpio: gpio_set_level(226): GPIO output gpio_num error  <==============
    semble indiquer qu'un gpio_set_level a été appliqué sur le pin N° 226, qui n'existe pas.

  3. #3
    Membre éprouvé
    Inscrit en
    Juillet 2004
    Messages
    936
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 936
    Par défaut
    Salut Jay M

    merci d'avoir repondu

    je ne comprends pas je n'ai aucun lien vers "pinMode(226)" pourtant dans le programme ...

  4. #4
    Expert confirmé

    Homme Profil pro
    mad scientist :)
    Inscrit en
    Septembre 2019
    Messages
    2 887
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : mad scientist :)

    Informations forums :
    Inscription : Septembre 2019
    Messages : 2 887
    Par défaut
    peut-être un bug lié à un débordement de mémoire et une modification d'une variable représentant une pin dans un des accès ou une bibliothèque incompatible avec un esp32s3 ?

  5. #5
    Membre éprouvé
    Inscrit en
    Juillet 2004
    Messages
    936
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 936
    Par défaut
    En fait , ces messages d'erreur ne semblent pas bloquants ( mais je n'ai pas trouvé leurs significations)
    comme je le supposais au départ par contre le blocage du programme était là :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
     while(!timeClient.update()) {
              timeClient.forceUpdate();
            }
    le programme bouclait dans l'attente d'un update, je l'ai donc remplacé par :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     timeClient.update();
    et maintenant que le programme tourne à peu près, j'ai une autre requête
    comment fait-on pour extraire la date à partir de la librairie NTPClient ?
    on pouvait penser que le format était celui-ci par ex : 2018-05-28T16:00:13Z
    mais çà ne semble plus être le cas
    existe-t-il une autre pratique ?

Discussions similaires

  1. Problème d'indentation (Serveur TCP - GPIO - MySQLi - Tx Série)
    Par Waryard dans le forum Général Python
    Réponses: 6
    Dernier message: 31/05/2019, 21h43
  2. Problème GPIO communication série
    Par Flokon42 dans le forum Raspberry Pi
    Réponses: 6
    Dernier message: 30/04/2017, 19h22
  3. Problème d'installation oracle 8.1.7 sous NT
    Par Anonymous dans le forum Installation
    Réponses: 7
    Dernier message: 02/08/2002, 14h18
  4. Problème avec la mémoire virtuelle
    Par Anonymous dans le forum CORBA
    Réponses: 13
    Dernier message: 16/04/2002, 16h10
  5. Réponses: 6
    Dernier message: 25/03/2002, 21h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo