loopyengineeringco / Daly2Sofar

ESP32 bridge allowing Daly Smart BMS to be used with a Sofar inverter/charger (and others that use SMA CANBUS protocol).
29 stars 3 forks source link

Impossible to compile this code #1

Open BOBILLEChristophe opened 2 years ago

BOBILLEChristophe commented 2 years ago

Hello

Impossible to compile this code:

Wemos D1 ESP32 Arduino IDE

Thanks for the answer

Christophe

I_MQTTstuff:12:16: error: variable or field 'WiFiEvent' declared void void WiFiEvent(WiFiEvent_t event) { ^ I_MQTTstuff:12:16: error: 'system_event_id_t' was not declared in this scope I_MQTTstuff:31:23: error: variable or field 'onMqttDisconnect' declared void void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) { ^ I_MQTTstuff:31:23: error: 'AsyncMqttClientDisconnectReason' was not declared in this scope I_MQTTstuff:55:48: error: 'AsyncMqttClientMessageProperties' has not been declared void onMqttMessage(char topic, char payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) { ^ /Users/christophe/Desktop/Daly2Sofar-main 2/Daly2Sofar_v0.92/L_GeneralFunctions.ino: In function 'void getEverythingFromDaly()': L_GeneralFunctions:11:52: error: no matching function for call to 'Daly_BMS_UART::getPackMeasurements(float&, float&, float&)' bms.getPackMeasurements(volts, amps, percentage); ^ In file included from /Users/christophe/Desktop/Daly2Sofar-main 2/Daly2Sofar_v0.92/Daly2Sofar_v0.92.ino:126:0: /Users/christophe/Documents/Arduino/libraries/daly-bms-uart-main/daly-bms-uart.h:173:10: note: candidate: bool Daly_BMS_UART::getPackMeasurements() bool getPackMeasurements(); ^ /Users/christophe/Documents/Arduino/libraries/daly-bms-uart-main/daly-bms-uart.h:173:10: note: candidate expects 0 arguments, 3 provided L_GeneralFunctions:28:25: error: no matching function for call to 'Daly_BMS_UART::getPackTemp(int8_t&)' bms.getPackTemp(temp); ^ In file included from /Users/christophe/Desktop/Daly2Sofar-main 2/Daly2Sofar_v0.92/Daly2Sofar_v0.92.ino:126:0: /Users/christophe/Documents/Arduino/libraries/daly-bms-uart-main/daly-bms-uart.h:180:10: note: candidate: bool Daly_BMS_UART::getPackTemp() bool getPackTemp(); ^ /Users/christophe/Documents/Arduino/libraries/daly-bms-uart-main/daly-bms-uart.h:180:10: note: candidate expects 0 arguments, 1 provided L_GeneralFunctions:44:90: error: no matching function for call to 'Daly_BMS_UART::getMinMaxCellVoltage(float&, uint8_t&, float&, uint8_t&)' bms.getMinMaxCellVoltage(minCellVoltage, minCellNumber, maxCellVoltage, maxCellNumber); ^ In file included from /Users/christophe/Desktop/Daly2Sofar-main 2/Daly2Sofar_v0.92/Daly2Sofar_v0.92.ino:126:0: /Users/christophe/Documents/Arduino/libraries/daly-bms-uart-main/daly-bms-uart.h:187:10: note: candidate: bool Daly_BMS_UART::getMinMaxCellVoltage() bool getMinMaxCellVoltage(); ^ /Users/christophe/Documents/Arduino/libraries/daly-bms-uart-main/daly-bms-uart.h:187:10: note: candidate expects 0 arguments, 4 provided /Users/christophe/Desktop/Daly2Sofar-main 2/Daly2Sofar_v0.92/X_Main.ino: In function 'void setup()': X_Main:42:37: error: no matching function for call to 'AsyncMqttClient::onMessage()' mqttClient.onMessage(onMqttMessage); ^ In file included from /Users/christophe/Documents/Arduino/libraries/async-mqtt-client-develop/src/AsyncMqttClient.h:4:0, from /Users/christophe/Desktop/Daly2Sofar-main 2/Daly2Sofar_v0.92/Daly2Sofar_v0.92.ino:112: /Users/christophe/Documents/Arduino/libraries/async-mqtt-client-develop/src/AsyncMqttClient.hpp:75:20: note: candidate: AsyncMqttClient& AsyncMqttClient::onMessage(AsyncMqttClientInternals::OnMessageUserCallback) AsyncMqttClient& onMessage(AsyncMqttClientInternals::OnMessageUserCallback callback);

loopyengineeringco commented 2 years ago

Hi @BOBILLEChristophe I think the errors are showing that you are missing the correct libraries: do you have the Async MQTT and TCP libraries installed?

tobydavies11 commented 2 years ago

I’m also having the same issues…

the daly uart library seems to not recognise

'Daly_BMS_UART::getPackMeasurements(float&, float&, float&)'

and others

loopyengineeringco commented 2 years ago

@tobydavies11 what version Arduino IDE are you using? I think there were some changes that I wasn't aware of. When I tried to compile with a version newer than 1.8.5 I had errors. Might be worth checking if the Daly library author has made breaking changes, I can't think of any other reason why that wouldn't compile

tobydavies11 commented 2 years ago

1.8.5as per the build guide, and all the dependencies stated.

I also think the daly library has been modified.

if you remove what’s inside the brackets for get pack measurement it then compiled.

I’ve thus added;

bms.getPackMeasurements()

float volts = bms.get.packVoltage float amps = bms.get.packCurrent Float percentage = bms.get.packSOC

And repeated for any of the daly service calls

I’ve been unable to test on a live system yet to confirm if this fixes.

loopyengineeringco commented 2 years ago

Thanks guys for your work. Looks like there's been a flurry of activity in the Daly Arduino github, so most likely the lib has changed slightly. @tobydavies11 if you could let me know when you get a chance to test it on your live system, I'll do the updates here. Or I might give it a test on my system tomorrow if I get some time. Thanks!

tobydavies11 commented 2 years ago

No Probs! Thanks for great work in getting the initial up and running.

It will take me a few days to report back.

Turbojo1 commented 2 years ago

Hi, is there any update on this as I've spent all day trying to get it to work. It's now gone past my level of expertise!

loopyengineeringco commented 2 years ago

Hi @Turbojo1

I've collected the Daly lib version that was used for the development of this into the Arduino dependencies folder. There are other libs in there too in case it helps. It was updated shortly after I released this, and broke the compatibility and I never quite got round to fixing this properly. I plan to eventually, but as this is at the bottom of my priority list - try to use the older Daly lib I uploaded for now.

Willpowerandstring commented 1 year ago

managed to compile on arduino 1.8.5 using the included libraries.Something in the LCD library caused a boot loop though - I removed all references to the LCD in the code and it's working fine ( Having no LCD isn't a dealbreaker for me ). Just waiting on a CAN chip to test fully.

felixganzer commented 7 months ago

I was able to compile when I add all the source code to one .ino file.