With the printed circuit boards (PCB's) being manufactured in China, there is not a lot to do, other than order the components from the usual suspects, Mouser, Digikey, Farnell, Rapid Electronics and eBay for a couple of TFT displays.
The first thing I'll want to do when they arrive is to build them and try and make them work, only to find out the mistakes I made when I missed things before manufacturing.
So, a good time to set up the development environment properly, initialise the git repos for each module, import the old v1 codebases in for main unit start updating the old code ready for the new boards, this means :
- Moving the code into PlatformIO on Visual Studio Code, generating the platformio.ini files, importing the libraries I need and ignoring for now, the platformIO registry, which has the latest versions of equivilent libraries to the Arduino library manager. I want to keep to what I had before, so less change / risk of things to go wrong and of course more risk of hitting bugs that have already been squashed in the current versions of the libraries, along with the new yet-to-be-found bugs that arrived at the same time.
- Removing all the obsolete code that isn't needed in the new environment
- Atmel specific code such as PROGMEM, F() functions that preserve the precious and very limited RAM.
This is not necessary on the ESP32 - All the functionality that was dropped from version 1, rat lights, webcams, etc.
- Atmel specific code such as PROGMEM, F() functions that preserve the precious and very limited RAM.
- Removing old code that performs logging to EEPROM, as I'm going to do that differently.
- Removing the old code that stores calibration on EEPROM and moving that to ESP32 Preferences storage
- Upgrading existing C++ classes for IO Expanders, Analogue to Digital Converters, Pulse Width Modulation (PWM), so that common functions can be used, irrespective of how something is connected on a board.
- Create new classes for UART's, and Motors
- Re-map all the pins that were direct to the Atmega 2560, but are now on connected devices.
- Start thinking about FreeRTOS and what moves to separate tasks, what runs in queues, how inter-process communication works
- Realise that I need new code to :
- Artibtrate SPI bus access and the SPI decoder / multiplexer, so that SPI transactions can complete uninterrupted. Read up on FreeRTOS Mutexes and start coding up for them in all the SPI and I2C code.
- Handle interrupts from all the cascaded devices such as IO expanders and over current interrupts from motor drivers, UART ring buffers filling up, GPS receivers sending data to UARTS that needs receiving and decoding.
- Realise that I've forgotten about the diagnostic display for debugging, I'll need to build one of those. Then realise that the 0.96 inch OLED displays that I used are no longer a great option, so that code will all need moving to a small 1.8 inch TFT display, which means that all the menus and positioning needs to be updated and on closer inspection, that means that I have much more space, so all the menus and layouts need updating and things can be simpler. Nice.
So much for re-using the old code to get going quickly on the new boards. Right now, it would just be nice if it would compile and link properly and of course, not all of this is needed right at the start, I'll want to turn off 99% of it and start bringing things up in a controlled manner to test the PCB once its ready - the aptly named smoke test. Once I know that the boards are OK from the basics, I can start building up the complex stuff and thats when the scope and logic analyser will come out to play.
Did I mention yet that there is the front panel code base to get ready too, that would be really handy to fork from the main units code base once it compiles, then I'll need to rip out all the things that are not relevant and code in all the new things such as the I2C request / command to local SPI traffic.
The components turn up as do the PCB's and their stencils, which help with assembly.