Skip to content

Commit

Permalink
Merge pull request #1 from openspaceaarhus/flipmos_instruction
Browse files Browse the repository at this point in the history
Flipmos instruction
  • Loading branch information
RobinOvergaard authored Sep 27, 2022
2 parents 219902b + 35be38e commit 60f8f18
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16)

project(FlipDots)

Expand Down
28 changes: 26 additions & 2 deletions flipmos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
cmake_minimum_required(VERSION 3.16)
project("Flipmos")

set(SSID "osaa-5" CACHE STRING "The access point ssid to us")
set(PASSWORD "deadbeef" CACHE STRING "The wifi password ")
set(MDNS_NAME "flipmos" CACHE STRING "The multicast name")
set(WEMOS_PORT "/dev/usb0" CACHE STRING "The port where the wemos is attached")
set(FQBN "esp8266:esp8266:d1" CACHE STRING "The Fully Qualified Board Name")

configure_file(
Config.h.in
${CMAKE_CURRENT_SOURCE_DIR}/Config.h
@ONLY
)

add_custom_target(
flipmos_init
#works on ubuntu something
# COMMAND sudo snap install arduino-cli
COMMAND arduino-cli --config-file arduino-cli.yaml core update-index
COMMAND arduino-cli --config-file arduino-cli.yaml core install esp8266:esp8266
COMMAND arduino-cli --config-file arduino-cli.yaml lib install "Adafruit GFX Library"
COMMAND arduino-cli --config-file arduino-cli.yaml lib install "Adafruit SSD1306 Wemos Mini OLED"
)

set_target_properties(
flipmos_init
PROPERTIES
EXCLUDE_FROM_ALL 1
)


add_custom_target(
flipmos
COMMAND arduino --verify ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino
COMMAND arduino-cli --config-file arduino-cli.yaml compile --fqbn ${FQBN} ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino
)

add_custom_target(
flipmos_upload
COMMAND arduino --upload ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino
COMMAND arduino-cli --config-file arduino-cli.yaml upload -p ${WEMOS_PORT} --fqbn ${FQBN} ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino

)

# Do not upload when building all
Expand All @@ -24,3 +47,4 @@ set_target_properties(
PROPERTIES
EXCLUDE_FROM_ALL 1
)

44 changes: 44 additions & 0 deletions flipmos/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Getting started #

Get prerequisites: CMake, Make etc

and arduino-cli
on ubuntu this can be installed with:

sudo snap install arduino-cli

## Configure the build ##
The SSID / Password is set as variables in CMakeLists.txt

The WEMOS_PORT is where the wemos is connected

You can change them by editing your local copy, giving them as parameters for cmake.


## Setup a build ##
We need to create the Makefiles and insert values into the `Config.h` header
```
cd ~/flipdot/flimos
cmake -B build -DSSID=osaa-iot -DPASSWORD=hunter2 -DWEMOS_PORT="/dev/usb0"
```

## Prepare the wemos environment ##
Install all the wemos libraries we need

```
make -C build flipmos_init
```

## Build the flipmos binary ##
This steps compiles
```
make -C build flipmos
```
## deploy the flipmos binary ##
This will upload to `WEMOS_PORT`

```
make -C build flipmos_upload
```


3 changes: 3 additions & 0 deletions flipmos/arduino-cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
board_manager:
additional_urls:
- https://arduino.esp8266.com/stable/package_esp8266com_index.json

0 comments on commit 60f8f18

Please sign in to comment.