No description
  • C++ 53.3%
  • C 34.8%
  • Python 9.5%
  • PowerShell 2.4%
Find a file
apssd-admin a753ba3f95
Some checks are pending
/ ci (push) Waiting to run
Add Forgejo workflow pipeline.yml
2026-12-05 18:48:51 +00:00
.forgejo/workflows Add Forgejo workflow pipeline.yml 2026-12-05 18:48:51 +00:00
.vscode Fixed unit tests 2020-11-12 15:33:07 +01:00
_deploy Initial version 2020-01-08 17:31:52 +01:00
include Initial version 2020-01-08 17:31:52 +01:00
lib Minor fixes 2021-01-07 11:59:54 +01:00
src Fixed issue with fleet placement 2021-01-06 11:32:15 +01:00
test Removed dummy tests 2021-01-07 12:06:33 +01:00
.gitignore Initial version 2020-01-08 17:31:52 +01:00
buildpipeline.yml Create buildpipeline.yml 2021-01-05 18:30:12 +01:00
platformio.ini Initial version 2020-01-08 17:31:52 +01:00
README.md Update README.md 2022-02-18 21:44:21 +01:00

Battleship Embedded

A simple game of Battleship, written in C++ for embedded devices (ESP32).

Tools

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)

Using Docker

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

Build and upload firmware to device

To build the project, use

pio run

To upload the firmware to the device, use

pio run --target upload

Run unit-tests

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. You might have to run a pio run -e native once to install the native platform first.

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.

Deployment

You might find some helpful scripts in the _deploy folder.

To flash the firmware on the device, the esptool can be used. This is installed together with PlatformIO or can be installed separately by running

pip install esptool