After some hours I managed to solve the problem on the Arduino IDE (v2.3.6) and can now get my project to compile there. However, I still can't get the corrected version of my code to compile on Vscode. This is y Platformio.ini:
; PlatformIO Project Configuration File
;
; Build options: build...