Unable to compile Marlin for Anet A8 Printer: Prusa i3 clone / Anet A8
Arduino IDE: Ver 1.8.12
Firmware: Marlin-2.0.2
anet-board-master: 1.5.6 (from hardware/anet/avr/platform.txt 2018-03-02)
Configurations-relese: 2.0.5 (Configuration.h, -adv.h)
OS: Windows 10
Board selection: Anet V1.0


I successfully upgraded the stock firmware to a version with bootloader, calibrated and had it running. I started to add features one at a time, recompile and upload. I managed to break it while trying to improve the LCD button debounce which I increased to 25 ms:

#if HAS_ADC_BUTTONS
  #define ADC_BUTTON_DEBOUNCE_DELAY 16  // (ms) Increase if buttons bounce or repeat too fast
#endif


The compile worked, transferred, showed the splash screen and went blank. This repeated on power-cycle. I reversed the change but was unable to restore operation.

I have tried reinstalling Arduino IDE, copying the folders in again and compiling with the default configurations. I'm getting lots of errors and the compiler exits with:

C:\Users\username\AppData\Local\Temp\arduino_build_938465\sketch\src\MarlinCore.cpp:470:11: note: in expansion of macro 'disable_Z'
       disable_Z();
       ^~~~~~~~~
exit status 1
Error compiling for board Anet V1.0.


Can anyone give me some guidance on how to get going again?
I'm almost back in business.


I reinstalled the bootloader.
I switched from Arduino IDE to Visual Studio Code to compile using Crosslink's Anet A8 (Plus) Marlin 2.0 Installation Upgrade YouTube tutorial.


1. Bootloader

I'm using a Chinese USBasp and there are some confusing tutorials on the web which require upgrading the USBasp firmware using another USBasp or Arduino. I avoided this as follows:


I used the Arduino IDE to open the Example | Blink.ino.
Tools | Board: "Anet V1.0 (Optiboot)". (Opti in optiboot means "optimised" so the bootloader will take up less space allowing you to use more options in your Marlin configuration.h.)
Tools | Programmer: "USBasp".
Tools | Burn Booloader. (This will generate the hex file to be transferred to the Anet board. Save it somewhere you will find it.)


Download and install AVRDUDESS if you haven't got it. I used Ver. 2.11. Connect the USBasp to the Anet board and your computer.


Start AVRDUDESS.
Port: usb.
Baud rate: 250000.
Hit the Detect button and it should identify your Anet board.
Hit the Flash [...] button and select the Blink.ino.with_bootloader.sanguino.hex file.
Hit the Program button. It should all work.


You now have an Anet board with the OptiBootLoader installed.

Now follow Crosslink's video tutorial above using the normal USB connection.