A simple game of Battleship, written in C++ for embedded devices (ESP32).
While the code might work with other development tools, it has been created and tested by using VSCode (https://code.visualstudio.com) with the PlatformIO extension (https://platformio.org). For just executing task on the CLI, PlatformIO Core is sufficient (https://docs.platformio.org/en/latest/core/installation.html)
If you do not want to install PlatformIO and other needed tools locally, you can use a docker container to run the commands.
docker run -it -v ${PWD}:/battleship -w /battleship infinitecoding/platformio-for-ci bash
To build the project, use
pio run
To upload the firmware to the device, use
pio run --target upload
To allow running unit-tests on a development machine or in a build process, the code is part of a platform independent library. You can use the PlatformIO CLI to execute these tests
pio test -e native
This requires a locally installed g++ compiler. Alternatively you can execute the tests within a docker container (see above) that comes with all necessary tools.
You might find some helpful scripts in the _deploy folder.
To flash the firmware on the device, the esptool can be used. This is isntalled together with PlatformIO or can be installed separately by running
pip install esptool
Test