bmpenuelas / smart-strain-gauge-sensor

Use a Strain Gauge + HX711 Load Cell Amplifier as bed leveling sensor for any 3D Printer
7 stars 1 forks source link

Error Compling #1

Open ReadieS opened 1 year ago

ReadieS commented 1 year ago

Hi, I was trying to test out your code as it sounds pretty impressive. whenever I try to complie for an Arduino Nano i am getting errors compiling. I have copied HX711ext.h and HX711.cpp into the HX711 library but i am getting the following errors:

`In file included from E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\GaugeProbe.ino:10:0: E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.h:52:14: warning: extra qualification 'HX711ext::' on member 'check_span_fits_uint16' [-fpermissive] bool HX711ext::check_span_fits_uint16(uint32_t arg_span); ^~~~

In file included from E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp:4:0: E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711ext.h:52:14: warning: extra qualification 'HX711ext::' on member 'check_span_fits_uint16' [-fpermissive] bool HX711ext::check_span_fits_uint16(uint32_t arg_span); ^~~~

E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp: In constructor 'HX711ext::HX711ext(uint8_t, uint8_t, uint8_t)': HX711ext.cpp:12:90: error: no matching function for call to 'HX711::HX711(uint8_t&, uint8_t&, uint8_t&)' HX711ext::HX711ext(uint8_t dout, uint8_t pd_sck, uint8_t gain) : HX711(dout, pd_sck, gain) { ^

In file included from E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp:1:0: E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711.h:30:3: note: candidate: HX711::HX711() HX711(); ^~~~~

E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711.h:30:3: note: candidate expects 0 arguments, 3 provided E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711.h:19:7: note: candidate: constexpr HX711::HX711(const HX711&) class HX711 ^~~~~

E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711.h:19:7: note: candidate expects 1 argument, 3 provided E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp: At global scope: E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp:27:56: warning: default argument given for parameter 1 of 'void HX711ext::sample_for_span(uint32_t)' [-fpermissive] void HX711ext::sample_for_span(uint32_t ms = 10e3) { ^

In file included from E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp:4:0: E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711ext.h:48:14: note: previous specification in 'void HX711ext::sample_for_span(uint32_t)' here void sample_for_span(uint32_t ms = 10e3); ^~~~~~~

E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp:111:49: warning: default argument given for parameter 1 of 'void HX711ext::set_gain(uint8_t)' [-fpermissive] void HX711ext::set_gain(uint8_t gain = 128){ ^

In file included from E:\Dropbox\3d Printer\smart-strain-gauge-sensor-main\firmware\fw\GaugeProbe\HX711ext.cpp:4:0: E:\Documents\Arduino\libraries\HX711_Arduino_Library\src/HX711ext.h:66:14: note: previous specification in 'void HX711ext::set_gain(uint8_t)' here void set_gain(uint8_t gain = 128); ^~~~

exit status 1 no matching function for call to 'HX711::HX711(uint8_t&, uint8_t&, uint8_t&)' `

Can you confirm which library you were referencing as I am wondering if I am trying to use a different version?

Thanks

bmpenuelas commented 1 year ago

Hi, I have downloaded the latest version of the library and I could reproduce your error.

To fix it you need to download the version of the library that was available back then when I created this project (around July 2017).

You can get HX711.h and HX711.cpp here (bogde/HX711 commit e80de1c): https://github.com/bogde/HX711/tree/e80de1c07e990e07627ec215eec9e1efabf281ee