Closed Albalate closed 2 years ago
Thanks, good example.
Some remarks:
No showstoppers, will merge the PR in coming days after you fixed the failing build-CI.
The build fails on your new sketch with the eeprom code. It might be ESP specific.
sorry, All of the following boards have an EEPROM: (https://docs.arduino.cc/learn/programming/eeprom-guide) Arduino UNO Rev.3 Arduino UNO WiFi Rev.2 Arduino Mega 2560 Rev.3 Arduino Nano Every Arduino Micro Arduino Leonardo Arduino Nano
EEPROM.h
@Albalate
check - https://github.com/RobTillaart/HX711/runs/5526296592?check_suite_focus=true
line 580 and more shows the errors during compilation of your example
Last command: $ /home/runner/arduino-cli --format json compile --fqbn arduino:avr:uno --warnings all --dry-run /home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino: In function 'void StupEeprom()':
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:29:32: error: no matching function for call to 'EEPROMClass::begin(int)'
if (!EEPROM.begin(EEPROM_SIZE))
^
In file included from /home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:15:0:
/home/runner/.arduino15/packages/arduino/hardware/avr/1.8.5/libraries/EEPROM/src/EEPROM.h:125:11: note: candidate: EEPtr EEPROMClass::begin()
EEPtr begin() { return 0x00; }
^~~~~
/home/runner/.arduino15/packages/arduino/hardware/avr/1.8.5/libraries/EEPROM/src/EEPROM.h:125:11: note: candidate expects 0 arguments, 1 provided
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino: In function 'float SaveFloat(int, float)':
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:40:10: error: 'struct EEPROMClass' has no member named 'writeFloat'; did you mean 'write'?
EEPROM.writeFloat(addr, param);//EEPROM.put(address, param);
^~~~~~~~~~
write
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:41:10: error: 'struct EEPROMClass' has no member named 'commit'
EEPROM.commit();
^~~~~~
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino: In function 'long int SaveLong(int, long int)':
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:44:10: error: 'struct EEPROMClass' has no member named 'writeFloat'; did you mean 'write'?
EEPROM.writeFloat(addr, param);//EEPROM.put(address, param);
^~~~~~~~~~
write
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:45:10: error: 'struct EEPROMClass' has no member named 'commit'
EEPROM.commit();
^~~~~~
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino: In function 'void setup()':
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:123:12: error: 'struct EEPROMClass' has no member named 'commit'
EEPROM.commit();
^~~~~~
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:125:5: error: 'ESP' was not declared in this scope
ESP.restart();
^~~
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:125:5: note: suggested alternative: 'SP'
ESP.restart();
^~~
SP
Error during build: exit status 1
✗
Compiling hHX_set_persistent.ino for adafruit:samd:adafruit_metro_m4...
Last command: $ /home/runner/arduino-cli --format json compile --fqbn adafruit:samd:adafruit_metro_m4 --warnings all --dry-run /home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:15:10: fatal error: EEPROM.h: No such file or directory
15 | #include "EEPROM.h"
| ^~~~~~~~~~
compilation terminated.
Error during build: exit status 1
✗
You can restrict the platforms to only those that compile by adding a file to the example folder called .arduino-ci.yml
the content should be like this, but only the platforms that compile
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
# - uno
# - due
# - zero
# - leonardo
# - m4
- esp32
# - esp8266
# - mega2560
esp8266 might work too
Finally you must rename the example so it is EXPLICIT that it is an ESP32 specific example.
Other patched example does fail to build too
Discovered example sketch... HX_delta_scale.ino
Wildcard architecture in library.properties, using configured platforms...
uno
m4
esp32
...Wildcard architecture in library.properties, using configured platforms
Board package arduino:avr has a defined URL... ✓
Installing board package arduino:avr... ✓
Board package esp32:esp32 has a defined URL... ✓
Installing board package esp32:esp32... ✓
Board package adafruit:samd has a defined URL... ✓
Installing board package adafruit:samd... ✓
Compiling HX_delta_scale.ino for arduino:avr:uno...
Last command: $ /home/runner/arduino-cli --format json compile --fqbn arduino:avr:uno --warnings all --dry-run /home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino: In function 'void setup()':
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:15: error: 'dataPin' was not declared in this scope
scale.begin(dataPin, clockPin);
^~~~~~~
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:15: note: suggested alternative: 'atan'
scale.begin(dataPin, clockPin);
^~~~~~~
atan
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:24: error: 'clockPin' was not declared in this scope
scale.begin(dataPin, clockPin);
^~~~~~~~
Error during build: exit status 1
✗
Compiling HX_delta_scale.ino for adafruit:samd:adafruit_metro_m4...
Last command: $ /home/runner/arduino-cli --format json compile --fqbn adafruit:samd:adafruit_metro_m4 --warnings all --dry-run /home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino: In function 'void setup()':
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:15: error: 'dataPin' was not declared in this scope; did you mean 'atan'?
26 | scale.begin(dataPin, clockPin);
| ^~~~~~~
| atan
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:24: error: 'clockPin' was not declared in this scope
26 | scale.begin(dataPin, clockPin);
| ^~~~~~~~
Error during build: exit status 1
✗
Compiling HX_delta_scale.ino for esp32:esp32:featheresp32:FlashFreq=80...
Last command: $ /home/runner/arduino-cli --format json compile --fqbn esp32:esp32:featheresp32:FlashFreq=80 --warnings all --dry-run /home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino: In function 'void setup()':
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:15: error: 'dataPin' was not declared in this scope
scale.begin(dataPin, clockPin);
^~~~~~~
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:15: note: suggested alternative: 'atan'
scale.begin(dataPin, clockPin);
^~~~~~~
atan
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:24: error: 'clockPin' was not declared in this scope
scale.begin(dataPin, clockPin);
^~~~~~~~
/home/runner/Arduino/libraries/HX711/examples/HX_delta_scale/HX_delta_scale.ino:26:24: note: suggested alternative: 'clock_t'
scale.begin(dataPin, clockPin);
^~~~~~~~
clock_t
Error during build: exit status 1
✗
Missing declaration and initialization of the data and clock pin.
Compiling hHX_set_persistent.ino for arduino:avr:uno... ✓
Compiling hHX_set_persistent.ino for adafruit:samd:adafruit_metro_m4...
Last command: $ /home/runner/arduino-cli --format json compile --fqbn adafruit:samd:adafruit_metro_m4 --warnings all --dry-run /home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino
/home/runner/Arduino/libraries/HX711/examples/hHX_set_persistent/hHX_set_persistent.ino:11:10: fatal error: EEPROM.h: No such file or directory
11 | #include "EEPROM.h"
| ^~~~~~~~~~
compilation terminated.
Error during build: exit status 1
✗
Compiling hHX_set_persistent.ino for esp32:esp32:featheresp32:FlashFreq=80... ✓
now complia for arduino uno, when I finish the project that I have in hand, I will give it more love to make it compatible with other architectures esp32 and esp8266
now complia for arduino uno, when I finish the project that I have in hand, I will give it more love to make it compatible with other architectures esp32 and esp8266
Thanks,
the EEPROM.h library is included in the standard arduino libraries, I have compiled with Atom, Vsc, and the arduino ide v1 and v2, without any problem. the test is not correct. regards
the EEPROM.h library is included in the standard arduino libraries, I have compiled with Atom, Vsc, and the arduino ide v1 and v2, without any problem. the test is not correct. regards
You need to add an .arduino-ci.yml file, I mentioned before
@Albalate Check - https://github.com/RobTillaart/Cozir/tree/master/examples/Cozir_MEGA_3_channel_CO2 it has a .arduino-CI.yml to only allow a MEGA to run, the others platforms are commented.
You need to make a file that only allows UNO and ESP32 and comment the others.
Then it will compile and I can merge
the EEPROM.h library is included in the standard arduino libraries, I have compiled with Atom, Vsc, and the arduino ide v1 and v2, without any problem. the test is not correct. regards
You need to add an .arduino-ci.yml file, I mentioned before
I already had the file with only UNO, ESP32 and M4. now I have tried only with, UNO
And there is green light!
Can you please enable the ESP32 too in the .arduino-CI.yml file as that one compiled too.
It looks perfect, will merge tomorrow
I have added an example to calibrate the scale and add the result in the eeprom memory of arduino UNO. regards