PlatformIO Community

Six (really three) problems with this sick script

Good morning!
I want to make a weather station, and I found a code that does most of what I want in a much different way that I want to try. It does a lot more than I wanted, but each thing happens to be on my list. It’s too long to post:

Solving one of these problems will help me get past a challenge I have with definitions. I’m fresh from Arduino, so there’s been a lot of hand-holding and preprocessing. I need to understand how to define something early enough to keep it around for a whole program.

280

The ‘Const uint’ exceeds my capacity at the moment. I’d really like someone to just give me the answer, and I’ll make sure to learn it soon.

I can encounter no such error. Using a platformio.ini of

[env:heltec_wifi_lora_32_V2]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder 
lib_deps = 
    https://github.com/squix78/esp8266-oled-ssd1306
    Adafruit BME280 Library

(libraries added per the comments in the ino and by library finder)

and adding the .ino code as main.cpp while respecting the conversion rules by adding the function prototypes

void msOverlay(OLEDDisplay *display, OLEDDisplayUiState* state);
void drawFrame1(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawFrame4(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
float read_pressure();
String get_trend_text(float trend);
void ForecastToImgTxt(weather_description wx_text);
weather_description get_forecast_text(float pressure_now, float trend, bool range);
void wx_history_1hr();
void wx_history_3hr();
void update_time_and_data();
bool update_time();
int StartWiFi(const char* ssid, const char* password);

after line 178 of the original sketch, I get a succesful compilation

grafik

The 2 “problems” being reported by VSCode are unused variables

grafik

Which is indeed correct, p and t are not used. But that isn’t a fatal compilation error.

Ah! I assumed they were in there somewhere.

Thank you!

Looking again, I have no idea what you said. I also can’t remember how I got it down to 6 errors.

I have 35 problems. As usual, nothing is declared.

What does ‘after line 178’ mean? I only care if the whole thing compiles, and it’s not working.

Why did you retype those lines?

The only thing I see that’s different is in the .ini file. I’ve been told only to put edited libraries in the lib folder.

I think I’m in worse shape after your help.

Half of the errors:

#warning "Please include TimeLib.h, not Time.h.  Future versions will remove Time.h"
  ^
In file included from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:64:0,
                 from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplayUi.h:43,
                 from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplayUi.cpp:32:
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplayFonts.h:1:0: error: unterminated #ifndef
 #ifndef OLEDDISPLAYFONTS_h
 ^
In file included from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:64:0,
                 from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:38:
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplayFonts.h:1:0: error: unterminated #ifndef
 #ifndef OLEDDISPLAYFONTS_h
 ^
In file included from C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/SSD1306Wire.h:34:0,
                 from C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/SSD1306.h:33,
                 from src\main1.cpp:19:
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:124:1: error: expected '}' before 'enum'
 enum OLEDDISPLAY_COLOR {
 ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:124:1: error: expected ',' or ';' before 'enum'
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:179:19: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setColor(OLEDDISPLAY_COLOR color);
                   ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:182:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR getColor();
     ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:188:46: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setPixelColor(int16_t x, int16_t y, OLEDDISPLAY_COLOR color);
                                              ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:339:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR            color;
     ^
src\main1.cpp: In function 'void setup()':
src\main1.cpp:69:31: error: 'StartWiFi' was not declared in this scope
   if (!StartWiFi(ssid,password)) Serial.println("Failed to start WiFi Service after 20 attempts");;
                               ^
src\main1.cpp:76:13: error: a function-definition is not allowed here before '{' token
 void loop() {
             ^
src\main1.cpp:66:9: warning: unused variable 'p' [-Wunused-variable]
   float p,t;
         ^
src\main1.cpp:66:11: warning: unused variable 't' [-Wunused-variable]
   float p,t;
           ^
src\main1.cpp:78:1: error: expected '}' at end of input
 }
 ^
In file included from C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/SSD1306Wire.h:34:0,
                 from C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/SSD1306.h:33,
                 from src\main.cpp:18:
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:124:1: error: expected '}' before 'enum'
 enum OLEDDISPLAY_COLOR {
 ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:124:1: error: expected ',' or ';' before 'enum'
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:179:19: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setColor(OLEDDISPLAY_COLOR color);
                   ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:182:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR getColor();
     ^
In file included from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplayUi.h:43:0,
                 from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplayUi.cpp:32:
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:124:1: error: expected '}' before 'enum'
 enum OLEDDISPLAY_COLOR {
 ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:188:46: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setPixelColor(int16_t x, int16_t y, OLEDDISPLAY_COLOR color);
                                              ^
C:/Users/joema/Documents/libraries/ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays/src/OLEDDisplay.h:339:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR            color;
     ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:124:1: error: expected ',' or ';' before 'enum'
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:179:19: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setColor(OLEDDISPLAY_COLOR color);
                   ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:182:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR getColor();
     ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:188:46: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setPixelColor(int16_t x, int16_t y, OLEDDISPLAY_COLOR color);
                                              ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:339:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR            color;
     ^
In file included from C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:38:0:
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:124:1: error: expected '}' before 'enum'
 enum OLEDDISPLAY_COLOR {
 ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:124:1: error: expected ',' or ';' before 'enum'
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:179:19: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setColor(OLEDDISPLAY_COLOR color);
                   ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:182:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR getColor();
     ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:188:46: error: 'OLEDDISPLAY_COLOR' has not been declared
     void setPixelColor(int16_t x, int16_t y, OLEDDISPLAY_COLOR color);
                                              ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.h:339:5: error: 'OLEDDISPLAY_COLOR' does not name a type
     OLEDDISPLAY_COLOR            color;
     ^
*** [.pio\build\esp32doit-devkit-v1\src\main1.cpp.o] Error 1
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In constructor 'OLEDDisplay::OLEDDisplay()':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:45:2: error: 'color' was not declared in this scope
  color = WHITE;
  ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:45:10: error: 'WHITE' was not declared in this scope
  color = WHITE;
          ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: At global scope:
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:127:28: error: variable or field 'setColor' declared void
 void OLEDDisplay::setColor(OLEDDISPLAY_COLOR color) {
                            ^
*** [.pio\build\esp32doit-devkit-v1\libded\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\OLEDDisplayUi.cpp.o] Error 1
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:127:28: error: 'OLEDDISPLAY_COLOR' was not declared in this scope
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:131:1: error: 'OLEDDISPLAY_COLOR' does not name a type
 OLEDDISPLAY_COLOR OLEDDisplay::getColor() {
 ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::setPixel(int16_t, int16_t)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:137:13: error: 'color' was not declared in this scope
     switch (color) {
             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:138:12: error: 'WHITE' was not declared in this scope
       case WHITE:   buffer[x + (y / 8) * this->width()] |=  (1 << (y & 7)); break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:139:12: error: 'BLACK' was not declared in this scope
       case BLACK:   buffer[x + (y / 8) * this->width()] &= ~(1 << (y & 7)); break;
            ^
src\main.cpp: In function 'void drawFrame1(OLEDDisplay*, OLEDDisplayUiState*, int16_t, int16_t)':
src\main.cpp:193:75: error: 'get_forecast_text' was not declared in this scope
   ForecastToImgTxt(get_forecast_text(reading[23].pressure, trend, look_3hr));          // From forecast and trend determine what image to display
                                                                           ^
src\main.cpp:193:76: error: 'ForecastToImgTxt' was not declared in this scope
   ForecastToImgTxt(get_forecast_text(reading[23].pressure, trend, look_3hr));          // From forecast and trend determine what image to display
                                                                            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:140:12: error: 'INVERSE' was not declared in this scope
       case INVERSE: buffer[x + (y / 8) * this->width()] ^=  (1 << (y & 7)); break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: At global scope:
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:145:55: error: 'OLEDDISPLAY_COLOR' has not been declared
 void OLEDDisplay::setPixelColor(int16_t x, int16_t y, OLEDDISPLAY_COLOR color) {
                                                       ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::setPixelColor(int16_t, int16_t, int)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:148:12: error: 'WHITE' was not declared in this scope
       case WHITE:   buffer[x + (y / 8) * this->width()] |=  (1 << (y & 7)); break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:149:12: error: 'BLACK' was not declared in this scope
       case BLACK:   buffer[x + (y / 8) * this->width()] &= ~(1 << (y & 7)); break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:150:12: error: 'INVERSE' was not declared in this scope
       case INVERSE: buffer[x + (y / 8) * this->width()] ^=  (1 << (y & 7)); break;
            ^
src\main.cpp:196:84: error: 'get_trend_text' was not declared in this scope
   display->drawStringMaxWidth(x+45,y+25,90,String(trend,1)+" "+get_trend_text(trend)); // and pressure trend
                                                                                    ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::clearPixel(int16_t, int16_t)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:157:13: error: 'color' was not declared in this scope
     switch (color) {
             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:158:12: error: 'BLACK' was not declared in this scope
       case BLACK:   buffer[x + (y >> 3) * this->width()] |=  (1 << (y & 7)); break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:159:12: error: 'WHITE' was not declared in this scope
       case WHITE:   buffer[x + (y >> 3) * this->width()] &= ~(1 << (y & 7)); break;
            ^
src\main.cpp: In function 'void drawFrame2(OLEDDisplay*, OLEDDisplayUiState*, int16_t, int16_t)':
src\main.cpp:202:88: error: 'get_forecast_text' was not declared in this scope
   weather_description wx_text = get_forecast_text(reading[23].pressure, trend, look_3hr); // Convert to forecast text based on 3-hours
                                                                                        ^
src\main.cpp:203:27: error: 'ForecastToImgTxt' was not declared in this scope
   ForecastToImgTxt(wx_text);                                                              // Display corresponding text
                           ^
src\main.cpp:204:20: error: 'ArialMT_Plain_16' was not declared in this scope
   display->setFont(ArialMT_Plain_16);
                    ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:160:12: error: 'INVERSE' was not declared in this scope
       case INVERSE: buffer[x + (y >> 3) * this->width()] ^=  (1 << (y & 7)); break;
            ^
src\main.cpp: In function 'void drawFrame4(OLEDDisplay*, OLEDDisplayUiState*, int16_t, int16_t)':
src\main.cpp:242:64: error: 'read_pressure' was not declared in this scope
   reading[23].pressure = (reading[23].pressure + read_pressure())/2;                 // Update rolling average, gets reset on the hour transition
                                                                ^
src\main.cpp:244:83: error: 'get_forecast_text' was not declared in this scope
   weather_description wx_text = get_forecast_text(read_pressure(), trend, look_1hr); // Convert to forecast text based on 1-hours
                                                                                   ^
src\main.cpp:245:27: error: 'ForecastToImgTxt' was not declared in this scope
   ForecastToImgTxt(wx_text);
                           ^
src\main.cpp:249:84: error: 'get_trend_text' was not declared in this scope
   display->drawStringMaxWidth(x+47,y+32,90,String(trend,1)+" "+get_trend_text(trend));
                                                                                    ^
src\main.cpp: In function 'void drawFrame5(OLEDDisplay*, OLEDDisplayUiState*, int16_t, int16_t)':
src\main.cpp:254:64: error: 'read_pressure' was not declared in this scope
   reading[23].pressure = (reading[23].pressure + read_pressure())/2;                 // Update rolling average
                                                                ^
src\main.cpp:256:83: error: 'get_forecast_text' was not declared in this scope
   weather_description wx_text = get_forecast_text(read_pressure(), trend, look_1hr); // Convert to forecast text based on 1-hours
                                                                                   ^
src\main.cpp:257:27: error: 'ForecastToImgTxt' was not declared in this scope
   ForecastToImgTxt(wx_text);
                           ^
src\main.cpp:259:20: error: 'ArialMT_Plain_16' was not declared in this scope
   display->setFont(ArialMT_Plain_16);
                    ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawHorizontalLine(int16_t, int16_t, int16_t)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:325:11: error: 'color' was not declared in this scope
   switch (color) {
           ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:326:10: error: 'WHITE' was not declared in this scope
     case WHITE:   while (length--) {
          ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:329:10: error: 'BLACK' was not declared in this scope
     case BLACK:   drawBit = ~drawBit;   while (length--) {
          ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:332:10: error: 'INVERSE' was not declared in this scope
     case INVERSE: while (length--) {
          ^
src\main.cpp: In function 'weather_description get_forecast_text(float, float, bool)':
src\main.cpp:308:133: error: 'wx_history_3hr' was not declared in this scope
      (trend_str == "Steady" || trend_str == "Rising slow"))                              {wx_text = NoChange; (range?wx_history_3hr():wx_history_1hr()); }
                                                                                                                                     ^
src\main.cpp:308:150: error: 'wx_history_1hr' was not declared in this scope
      (trend_str == "Steady" || trend_str == "Rising slow"))                              {wx_text = NoChange; (range?wx_history_3hr():wx_history_1hr()); }
                                                                                                                                                      ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawVerticalLine(int16_t, int16_t, int16_t)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:368:13: error: 'color' was not declared in this scope
     switch (color) {
             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:369:12: error: 'WHITE' was not declared in this scope
       case WHITE:   *bufferPtr |=  drawBit; break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:370:12: error: 'BLACK' was not declared in this scope
       case BLACK:   *bufferPtr &= ~drawBit; break;
            ^
src\main.cpp:314:136: error: 'wx_history_3hr' was not declared in this scope
   if (pressure_now >= 1013.2 && pressure_now <= 1022.68 && trend_str  == "Steady")       {wx_text = ClearSpells; (range?wx_history_3hr():wx_history_1hr());};
                                                                                                                                        ^
src\main.cpp:314:153: error: 'wx_history_1hr' was not declared in this scope
   if (pressure_now >= 1013.2 && pressure_now <= 1022.68 && trend_str  == "Steady")       {wx_text = ClearSpells; (range?wx_history_3hr():wx_history_1hr());};
                                                                                                                                                         ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:371:12: error: 'INVERSE' was not declared in this scope
       case INVERSE: *bufferPtr ^=  drawBit; break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:381:13: error: 'color' was not declared in this scope
     switch (color) {
             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:382:12: error: 'WHITE' was not declared in this scope
       case WHITE:
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:383:12: error: 'BLACK' was not declared in this scope
       case BLACK:
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:391:12: error: 'INVERSE' was not declared in this scope
       case INVERSE:
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:403:13: error: 'color' was not declared in this scope
     switch (color) {
             ^
src\main.cpp: In function 'void setup()':
src\main.cpp:357:31: error: 'StartWiFi' was not declared in this scope
   if (!StartWiFi(ssid,password)) Serial.println("Failed to start WiFi Service after 20 attempts");;
                               ^
src\main.cpp:365:23: error: 'update_time' was not declared in this scope
   while (!update_time());  //Get the latest time
                       ^
src\main.cpp:354:9: warning: unused variable 'p' [-Wunused-variable]
   float p,t;
         ^
src\main.cpp:354:11: warning: unused variable 't' [-Wunused-variable]
   float p,t;
           ^
src\main.cpp: In function 'void loop()':
src\main.cpp:392:24: error: 'update_time_and_data' was not declared in this scope
   update_time_and_data();
                        ^
src\main.cpp: In function 'void update_time_and_data()':
src\main.cpp:402:23: error: 'update_time' was not declared in this scope
   while (!update_time());
                       ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:404:12: error: 'WHITE' was not declared in this scope
       case WHITE:   *bufferPtr |=  drawBit; break;
            ^
src\main.cpp: In function 'bool update_time()':
src\main.cpp:424:13: error: aggregate 'tm timeinfo' has incomplete type and cannot be defined
   struct tm timeinfo;
             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:405:12: error: 'BLACK' was not declared in this scope
       case BLACK:   *bufferPtr &= ~drawBit; break;
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:406:12: error: 'INVERSE' was not declared in this scope
       case INVERSE: *bufferPtr ^=  drawBit; break;
            ^
src\main.cpp:432:80: error: 'strftime' was not declared in this scope
   strftime(strftime_buf, sizeof(strftime_buf), "%R:%S   %a %d-%m-%y", &timeinfo);
                                                                                ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawProgressBar(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:418:12: error: 'WHITE' was not declared in this scope
   setColor(WHITE);
            ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawIco16x16(int16_t, int16_t, const char*, bool)':
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:461:45: error: 'WHITE' was not declared in this scope
         setPixelColor(xMove + x, yMove + y, WHITE);
                                             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:463:45: error: 'BLACK' was not declared in this scope
         setPixelColor(xMove + x, yMove + y, BLACK);
                                             ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawInternal(int16_t, int16_t, int16_t, int16_t, const uint8_t*, uint16_t, uint16_t)':    
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:933:23: error: 'class OLEDDisplay' has no member named 'color'
         switch (this->color) {
                       ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:934:16: error: 'WHITE' was not declared in this scope
           case WHITE:   buffer[dataPos] |= currentByte << yOffset; break;
                ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:935:16: error: 'BLACK' was not declared in this scope
           case BLACK:   buffer[dataPos] &= ~(currentByte << yOffset); break;
                ^
*** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:936:16: error: 'INVERSE' was not declared in this scope
           case INVERSE: buffer[dataPos] ^= currentByte << yOffset; break;
                ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:940:25: error: 'class OLEDDisplay' has no member named 'color'
           switch (this->color) {
                         ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:941:18: error: 'WHITE' was not declared in this scope
             case WHITE:   buffer[dataPos + this->width()] |= currentByte >> (8 - yOffset); break;
                  ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:942:18: error: 'BLACK' was not declared in this scope
             case BLACK:   buffer[dataPos + this->width()] &= ~(currentByte >> (8 - yOffset)); break;
                  ^
C:\Users\joema\Documents\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp:943:18: error: 'INVERSE' was not declared in this scope
             case INVERSE: buffer[dataPos + this->width()] ^= currentByte >> (8 - yOffset); break;
                  ^

Seems like most of your errors are coming from your preinstalled library. Maybe it’s corrupted / not up to date?

I’d suggest using the same platformio.ini (albeit with a different board = .. maybe) and use local library dependency management instead of global libraries.

After line 178 as referenced in the above .ino ifle.

As explained above due to the needed .ino -> .cpp conversion to make VSCode happy with full intellisense. Otherwise just leave it as a main.ino file instead of a cpp file.