Saur0o0n / PIDKiln

Kiln PID controller based on Espressif Systems ESP32 chip board with Arduino IDE.
GNU General Public License v2.0
109 stars 42 forks source link

Platformio Port #29

Open djObsidian opened 2 years ago

djObsidian commented 2 years ago

Fixed PIO port pull request.

So, that's a straightforward port to platformio. All .ino contents are copied to main.c, all PFP added to main.h. Also, encoder is replaced with buttons, encoder code is commented out. Things to do initialy:

Saur0o0n commented 2 years ago

We can use it as a start for platformio branch, but for me removing encoder in favor of buttons and merging everything to one file is no go for main branch. Mainly because removing encoder brakes initial setup - so the proper way would be to ADD buttons and allow to change it buttons/encoder in .h file before compiling. Are you up to it? :)

djObsidian commented 2 years ago

Yes, i'll change that. This is just my code as it is for now, i will continue working on this.

djObsidian commented 2 years ago

Moving ESPAsyncWebServer from project libs to dependencies is not required, since we are using modified version of it

djObsidian commented 2 years ago

@Saur0o0n So, i'm trying to separate main.cpp and main.h to several .h and .cpp files and noticed something weired: https://github.com/Saur0o0n/PIDKiln/blob/b9da27c5f9b2d874825d29ed0e71314416a40b97/PIDKiln_LCD.ino#L638 Here Load_program is called without any argument and it somehow compiles and works. And i have no problem compiling this code when everything is in one file and function is defined in main.h. But when i move it to different files - it trows an error: to few arguments.

Should this function be called here without an argument?

Saur0o0n commented 2 years ago

This function (and others) are define in .h file - it has default value defined, so if it's called without argument it assumes it.

`/ Function defs / void load_msg(char msg[MAX_CHARS_PL]); boolean return_LCD_string(char msg,char rest, int mod, uint16_t screen_w=SCREEN_W); void LCD_Display_program_summary(int dir=0,byte load_prg=0); void LCD_Display_quick_program(int dir=0,byte pos=0);

uint8_t Cleanup_program(uint8_t err=0); uint8_t Load_program(char *file=0); void ABORT_Program(uint8_t error=0);`

djObsidian commented 2 years ago

Thanks, i missed this moment

djObsidian commented 2 years ago

So, i managed to move all LCD related stuff to LCD.h and LCD.cpp files, just like in original arduino project. But it's not completely ideal (at least it compiles) and I need some assistance with this. For example https://github.com/djObsidian/PIDKiln/blob/47fa05190c7a7662e3d335a60c5688b869e2671e/src/LCD.cpp#L73 Using extern with this two const variables results in undefined reference and i have zero idea why. https://github.com/djObsidian/PIDKiln/blob/47fa05190c7a7662e3d335a60c5688b869e2671e/src/LCD.cpp#L87 This object should be also accesible in main.cpp but i don't know how to do extern object