gicking / LIN_master_Arduino

LIN master node emulation with preemptive background operation
MIT License
31 stars 3 forks source link

Fails to compile #1

Closed ev-olution closed 3 years ago

ev-olution commented 3 years ago

It fails to compile whatever I do. Even examples fails to compile. I always get same error:

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master_Arduino-master\src/LIN_master.h:33:10: error: #error This LIN library requires the "Task Scheduler" library by Kai Liebich & Georg Icking-Konert. Please install it via the Arduino library manager!

     #error This LIN library requires the "Task Scheduler" library by Kai Liebich & Georg Icking-Konert. Please install it via the Arduino library manager!

      ^~~~~

I have Task Sheduler v1.3 library and it works perfectly with other projects. I am using v1.8.5 Arduino. Any ideas why I get this error?

ev-olution commented 3 years ago

Ok it seems I found the problem. In LIN_master.h (C:\Users\Administrator\Documents\Arduino\libraries\LIN_master_Arduino-master\src/LIN_master.h) I had to replace this:

if !__has_include("../../Task_Scheduler/src/Tasks.h")

to this:

if !__has_include("../../Tasks-master/src/Tasks.h")

ev-olution commented 3 years ago

Still can't compile any of given examples. Now it gives error:

'LIN_master1' was not declared in this scope

gicking commented 3 years ago

I'll look into it. Sorry for the inconvenience!

gicking commented 3 years ago

I just deleted my own installation of "LIN Master" and "Task Scheduler", and re-installed them via the Arduino library manager. Specifically I installed "LIN Master" and on prompt selected "install all". Then I compiled all examples without issue for Mega and Due, even without the above mentioned change to "LIN_master.h".

1) which architecture & board do you want to compile for?

2) are you sure you have the latest versions installed? As I may have not correctly updated the version numbers, I propose you manually delete both from "Arduino/libraries" and re-install them fresh

PS: your above comment about Task Scheduler path is definitely strange. In my (new) installation the path to "Tasks.h" library is "../../Task_Scheduler/src/Tasks.h"

PPS: I just realized that the library folder name is "LIN_master_emulation_with_background_operation" and that I have a minor bugfix (for Due) already in Github. As soon as I find out how to do this I'll try to push a version update to Arduino library manager. But this is independent of the above statement

gicking commented 3 years ago

Ok, I think I understand your renaming issue now. If you download "Task Scheduler" zip file from Github and install it manually, the folder name is indeed "Tasks-master", and I don't know how to change that. However, if you install it via Arduino IDE library manager the folder name is "Task_Scheduler".

I have just commited a few minor changes and changed LIN Master library property such that the folder name should now be "LIN_master", not "LIN_master_emulation_with_background_operation". The new versions are 1.4 (Task Scheduler) and 1.1 (LIN master), respectively.

Please allow the Arduino web-crawler a few hours to notice this change. Then manually delete your "Task Scheduler" and "LIN Master" libraries from "Arduino/libraries" and re-install them via the Arduino IDE library manager. And please assert the above versions are correct. Then we know that we have the identical setup. If you still have issues compiling please let me know. Thanks in advance!

ev-olution commented 3 years ago

Wow, thanks for such quick response. You should be celebrating Christmas and not bother about code :) I really appreciate that. I will try to delete both libraries and reinstall them. Although I get no more problems with Task Scheduler after modifying LIN_master.h. Will report back if re-install did the trick. It might be that my Arduino needs a fresh install after so many libraries installed. Thanks again for your help. And have a nice Christmas and happy New Year!

ev-olution commented 3 years ago

I am bit confused how I get LIN_master1 errors if I am not even using library files associated with it. I try to compile the following code for Arduino UNO. It compiles without errors for MEGA, but if I change board to UNO in trows some errors. Here is my test code:

include "LIN_master0.h"

include "Tasks.h"

define PIN_TOGGLE 10

define LIN1_PERIOD 20

void setup(void) { pinMode(PIN_TOGGLE, OUTPUT);

LIN_master0.begin(19200, LIN_V2, true);

Tasks_Init(); Tasks_Add((Task) sendMasterRequest1, LIN1_PERIOD, 0); Tasks_Start();

} // setup()

void loop(void) { digitalWrite(PIN_TOGGLE, !digitalRead(PIN_TOGGLE));

} // loop()

void sendMasterRequest1(void) { static uint8_t count=0; uint8_t id = 0x05; uint8_t lenData = 8; uint8_t data[8]; memset(data, count++, lenData);

LIN_master0.sendMasterRequest(id, lenData, data);

} // sendMasterRequest1()

As you see I am not using LIN_master1 anywhere in my code. And that's the errors I get:

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:17:1: error: 'LIN_Master_1' does not name a type

LIN_Master_1 LIN_master1;

^~~~

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:24:1: error: 'LIN_Master_1' does not name a type

LIN_Master_1::LIN_Master_1()

^~~~

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp: In function 'void LIN_master1_send()':

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:54:3: error: 'LIN_master1' was not declared in this scope

LIN_master1.handlerSend();

^~~

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:54:3: note: suggested alternative: 'LIN_master1_send'

LIN_master1.handlerSend();

^~~

LIN_master1_send

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp: In function 'void LIN_master1_receive()':

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:68:3: error: 'LIN_master1' was not declared in this scope

LIN_master1.handlerReceive();

^~~

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:68:3: note: suggested alternative: 'LIN_master1_send'

LIN_master1.handlerReceive();

^~~

LIN_master1_send

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp: In function 'void LIN_master1_copy(uint8_t, uint8_t*)':

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:82:3: error: 'LIN_master1' was not declared in this scope

LIN_master1.defaultCallback(numData, data);

^~~

C:\Users\Administrator\Documents\Arduino\libraries\LIN_master\src\LIN_master1.cpp:82:3: note: suggested alternative: 'LIN_master1_copy'

LIN_master1.defaultCallback(numData, data);

^~~

LIN_master1_copy

Using library LIN_master at version 1.1 in folder: C:\Users\Administrator\Documents\Arduino\libraries\LIN_master Using library Task_Scheduler at version 1.3 in folder: C:\Users\Administrator\Documents\Arduino\libraries\Task_Scheduler exit status 1 Error compiling for board Arduino Uno.

gicking commented 3 years ago

ah, good point! I have to admit that I never tested it for Uno.... And apparently my understanding that only included files are compiled is incorrect.

In any case, I have now released a v1.2 which skips the content of LIN_masterN.cpp if the respective Serial doesn't exist. And this time I did test it for the Uno... ;-) Again, please allot the Arduino web crawler 24-48h to add this release to the library manager. The new versions are 1.2 (LIN master) and 1.4 (Task Scheduler)

PS: if you don't want to wait just mail me under icking AT onlinehome.de, then I can send you both libs beforehand

PPS: A (late) Merry Christmas and a Happy New Year to you, too! :-)

ev-olution commented 3 years ago

It compiles now successfully on Uno! Huge Thanks! Do you got any kind of "fund me" option? I am more than happy to send you few quid for your help so you can get yourself a drink ;) I think Github needs to consider such option, it would help contributors a lot if they could include something like Paypal donate button.

gicking commented 3 years ago

:-) Gee that was fast! Arduino states that their webcrawler takes 24-48h to include new versions into the library manager. But let's not complain... If you have further problems or questions, just let me know.

Nay, I have no fund me option. But thanks a lot for considering it! I'm just glad that someone has practical use for my work. Know what, next time you see a needy person just tip him/her in my name.

Have a great day and stay healthy! :-)

ev-olution commented 3 years ago

I updated library just by adding it as a .ZIP and renaming it in Arduino library folder. It worked for me without installing it via the Arduino IDE library manager. Thanks again!

gicking commented 3 years ago

:-) you're welcome