Open zevs44 opened 1 year ago
Hello, I'm sorry you ran into this issue with the library. I also found similar errors using the code on any boards other than the Arduino Uno. I have looked into it and have begun working on a fix. I will get the fixed library up as soon as I can because I too would like to use my sensors; however, my available time is limited. But I am working on it!
In the middle of writing this, I have decided that I will make a jank version of the library that will, at the very least, allow the readTVOC() function to be used seeing as that's the main function of the device :) The plan is to finish this by the end of the week. If I do not, I will be disappointed in myself.
See this fork for a fix: https://github.com/awao/AGS10_sensor_ESP32/
gina-seth, awao, thank you for the code. I got inspired from you to add support AGS10 to ESPHome. PR: https://github.com/esphome/esphome/pull/6070
Dear author, thanks for your library. I have try to integrate your library in esphome platform as a Custom Sensor (https://esphome.io/components/sensor/custom). I have made custom sensor definition and during compilation I have the following errors in AGS10.cpp:
./AGS10/AGS10.cpp:36:20: error: cast from 'uint8_t' {aka 'unsigned char'} to 'uint8_t' {aka 'unsigned char'} loses precision [-fpermissive] 36 | _crc = Calc_CRC8(uint8_t(data), uint8_t(0x01));
./AGS10/AGS10.cpp:36:20: error: invalid conversion from 'uint8_t' {aka 'unsigned char'} to 'uint8_t' {aka 'unsigned char'} [-fpermissive] ./AGS10/AGS10.cpp:6:35: note: initializing argument 1 of 'uint8_t AGS10::Calc_CRC8(uint8_t, uint8_t)' 6 | uint8_t AGS10::Calc_CRC8(uint8_t dat, uint8_t Num)
./AGS10/AGS10.cpp: In member function 'int AGS10::readVersion()': ./AGS10/AGS10.cpp:97:1: error: control reaches end of non-void function [-Werror=return-type]
./AGS10/AGS10.cpp: In member function 'int AGS10::readResist()': ./AGS10/AGS10.cpp:118:1: error: control reaches end of non-void function [-Werror=return-type]
./AGS10/AGS10.cpp: In member function 'int AGS10::readTVOC()': ./AGS10/AGS10.cpp:141:1: error: control reaches end of non-void function [-Werror=return-type]
Can you please consider fix of above errors?