plerup / espsoftwareserial

Implementation of the Arduino software serial for ESP8266
GNU Lesser General Public License v2.1
717 stars 270 forks source link

Error compiling for board ESP32 Dev Module - error: 'size_t SoftwareSerial::readBytes(uint8_t*, size_t)' marked 'override', but does not override #114

Closed our30K closed 5 years ago

our30K commented 5 years ago

Hi Gurus

I am relatively new to Arduino and ESP32, trying to work on a software serial connection from ESP32 dev board to another device. while trying the sample code from espsoftwareserial. I got the following compilation error, need some guidance, maybe doing something really dumb here :(

environment:

In file included from /Users/justin/Documents/Arduino/BasicSerialToBG95/BasicSerialToBG95.ino:1:0:
/Users/justin/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:72:9: error: 'size_t SoftwareSerial::readBytes(uint8_t*, size_t)' marked 'override', but does not override
  size_t readBytes(uint8_t* buffer, size_t size) override;
         ^
/Users/justin/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:73:9: error: 'size_t SoftwareSerial::readBytes(char*, size_t)' marked 'override', but does not override
  size_t readBytes(char* buffer, size_t size) override {
         ^
exit status 1
Error compiling for board ESP32 Dev Module.

below are the full source code

#include <SoftwareSerial.h>

SoftwareSerial swSer1;

//blink gree LED
uint8_t LED_BUILTIN_GREEN = 18;
uint8_t LED_BUILTIN_RED = 26;

//power on Quectel
uint8_t BG95_POWERON = 13;
uint8_t BG95_RESET = 15;

void setup()
{

  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN_GREEN, OUTPUT);

  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN_RED, OUTPUT);

  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }

  Serial.println("Goodnight moon!");
  // set the data rate for the SoftwareSerial port
  swSer1.begin(115200, 19, 27, SWSERIAL_8N1, false, 256);

}

void loop() // run over and over
{

Serial.println("*********Loop with Blinking ****");
  digitalWrite(LED_BUILTIN_GREEN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN_GREEN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);   

  Serial.println("\n\nTesting on swSer1");
  Serial.print("Enter something to send using swSer1.");
  checkSwSerial(&swSer1);

}

void checkSwSerial(SoftwareSerial* ss) {
  byte ch;
  while (!Serial.available());
  ss->enableTx(true);
  while (Serial.available()) {
    ch = Serial.read();
    ss->write(ch);
  }
  ss->enableTx(false);
  // wait 1 second for the reply from SOftwareSerial if any
  delay(1000);
  if (ss->available()) {
    Serial.print("\nResult:");
    while (ss->available()) {
      ch = (byte)ss->read();
      Serial.print(ch < 0x01 ? " 0" : " ");
      Serial.print(ch, HEX);
    }
    Serial.println();
  }
}
our30K commented 5 years ago

by the way, the ESPSoftwareSerial I use is v 5.2.9 installed via the manage library function,

Trottero commented 5 years ago

This is a duplicate of #104 You can add the dev builds to your additional board URLs setting and use 1.0.3-rc1 to fix this issue.

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md

dok-net commented 5 years ago

@trottero Thanks, similar issue reports keep cropping up for ESP8266. As newer versions of EspSoftwareSerial depend on patches to ESP32 or ESP8266, which haven't released since then, all I could have done was NOT "release" (tag in Github) EspSoftwareSerial. I am quite open to accepting PRs detailing which version of libraries work well with which version of BSPs - until then, the old rule "don't update unless you have a compelling reason (and are told so)" applies :-)