Code Monkey home page Code Monkey logo

s8_uart's People

Contributors

jcomas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

s8_uart's Issues

Suggestion to Enable Universal Serial Compatibility

Hello,

I hope everything is going well. I'm a user of Sense air S8 sensor, and I have a suggestion that could benefit many users facing challenges with serial communication on boards that don't have direct support for Softwareserial or HardwareSerial.

Suggestion: Implementation of EspSoftwareSerial for Boards Without Support

Currently, some users of boards, such as ESP32 LILYGO®LoRa32 V2.1_1.6, may encounter limitations with Softwareserial or HardwareSerial libraries. A valuable alternative would be the implementation of the EspSoftwareSerial library to provide a more flexible and comprehensive solution.

Implementation Suggestion:

  1. Add support for the EspSoftwareSerial library in the installation instructions or in the project's README. Additionally, provide a usage example to guide users in implementing EspSoftwareSerial in their projects.

  2. Usage Example:

    #include "s8_uart.h"
    #include <SoftwareSerial.h> //EspSoftwareSerial include
    
    EspSoftwareSerial::UART S8_serial;
    S8_UART *sensor_S8;
    S8_sensor sensor;
    
    void setup() {
      Serial.begin(9600);
      while (!Serial) {
      }
      // Initialize S8 sensor
      S8_serial.begin(S8_BAUDRATE, EspSoftwareSerial::SWSERIAL_8N1, 21, 22);
      sensor_S8 = new S8_UART(S8_serial);
    }
    
    void loop() {
      sensor.co2 = sensor_S8->get_co2();
      Serial.print("CO2 value = ");
      Serial.print(sensor.co2);
      Serial.println(" ppm");
      delay(1000);
    }
    

Contribution to the Community:
The inclusion of EspSoftwareSerial can provide a broader solution for users of various boards, improving usability and accessibility in projects that require serial communication.

Thank you for your attention and consideration. I am available to provide more information or clarify any doubts.

Best regards,
Natanael José

ESP8266 might crash in `S8_UART::serial_read_bytes` if sensor not connected

In https://github.com/jcomas/S8_UART/blob/main/examples/co2/co2.cpp, if Senseair S8 isn't connected, the example code is supposed to display Serial.println("SenseAir S8 CO2 sensor not found!");.

On a ESP8266, it often doesn't. The microcontroller crashes instead, because the while loop in S8_UART::serial_read_bytes blocks during 5 seconds, and the watchdog resets the ESP.

Adding a short delay (e.g. delay(50)) in the loop, before end_t = millis(); seems to fix the problem.

Other than that, the library seems to work well, on both ESP32 and ESP8266.
On ESP8266, I replaced SoftwareSerial with https://github.com/CrazyRobMiles/Esp8266EdgeSoftwareSerial, which uses much less memory.
Thanks for the good work!

Add a 1.0.0 tag

Hello,

I'm using your lib, and I'd like to add it to the Arduino library repository.

To do so, it need to have a tag with the version matching what you set in the library.properties file.

cf: arduino/library-registry#996

[feature request] support for Arduino framework on Atmelavr

Summary

Testing the library over old Arduino shield, I have the next compiling issue:

Indexing .pio/build/arduino/lib007/libSensirion Core.a
Compiling .pio/build/arduino/lib30a/S8_UART/modbus_crc.cpp.o
Compiling .pio/build/arduino/lib30a/S8_UART/s8_uart.cpp.o
.pio/libdeps/arduino/S8_UART/src/modbus_crc.cpp:45:1: error: narrowing conversion of '192' from 'int' to 'char' inside { } [-Wnarrowing]
 };
 ^
.pio/libdeps/arduino/S8_UART/src/modbus_crc.cpp:45:1: error: narrowing conversion of '193' from 'int' to 'char' inside { } [-Wnarrowing]
.pio/libdeps/arduino/S8_UART/src/modbus_crc.cpp:45:1: error: narrowing conversion of '195' from 'int' to 'char' inside { } [-Wnarrowing]
.pio/libdeps/arduino/S8_UART/src/modbus_crc.cpp:45:1: error: narrowing conversion of '194' from 'int' to 'char' inside { } [-Wnarrowing]

Environment

With the next PlatformIO config:

[arduino_avr]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
monitor_speed = ${env.monitor_speed}
build_flags =
  ${env.build_flags}
lib_deps =
  ${env.lib_deps}

Tested in the next branch of CanAirIO Sensorslib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.