Skip to content

Commit a191032

Browse files
authored
Merge pull request #801 from sparkfun/release_candidate
Resolve #800. Add Dockerfile and compilation instructions
2 parents 14630e4 + f014f18 commit a191032

25 files changed

+397
-39
lines changed

Firmware/Dockerfile

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
FROM ubuntu:latest AS upstream
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
ENV FILENAME_PREFIX=RTK_Firmware
6+
ENV FIRMWARE_VERSION_MAJOR=99
7+
ENV FIRMWARE_VERSION_MINOR=99
8+
ENV CORE_VERSION=2.0.2
9+
10+
# ESP32 Core Debug Level
11+
# We use "none" for releases and "error" for release_candidate
12+
# You may find "verbose" useful while you are debugging your changes
13+
ENV DEBUG_LEVEL=error
14+
15+
# Developer Mode
16+
# You may find "true" useful while you are making changes
17+
# Set to false for releases
18+
ENV ENABLE_DEVELOPER=true
19+
20+
# If you have your own u-blox PointPerfect token, define it here
21+
# or pass it in as an arg when building the Dockerfile
22+
ARG POINTPERFECT_TOKEN=0xAA,0xBB,0xCC,0xDD,0x00,0x11,0x22,0x33,0x0A,0x0B,0x0C,0x0D,0x00,0x01,0x02,0x03
23+
24+
# Get curl and python3
25+
RUN apt-get update \
26+
&& apt-get install -y curl python3 python3-pip python3-venv python-is-python3 \
27+
&& apt-get clean \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# Avoid the externally managed environment constraint
31+
RUN PYTHON_VER=$(ls /usr/lib | grep python3.) \
32+
&& echo "Python version: ${PYTHON_VER}" \
33+
&& rm /usr/lib/${PYTHON_VER}/EXTERNALLY-MANAGED
34+
35+
# Install Python dependencies - esptool needs pyserial
36+
#RUN python3 -m pip install --upgrade pip && \
37+
RUN pip install pyserial
38+
39+
# Setup Arduino CLI
40+
#RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh
41+
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
42+
43+
# Start config file
44+
RUN arduino-cli config init --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json,https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json
45+
46+
# Update core index
47+
RUN arduino-cli core update-index
48+
49+
# Update library index
50+
RUN arduino-cli lib update-index
51+
52+
# Install platform
53+
RUN arduino-cli core install "esp32:esp32@${CORE_VERSION}"
54+
55+
# Get Known Libraries
56+
RUN arduino-cli lib install [email protected]
57+
RUN arduino-cli lib install [email protected]
58+
RUN arduino-cli lib install [email protected]
59+
RUN arduino-cli lib install "ESP32-OTA-Pull"@1.0.0
60+
RUN arduino-cli lib install [email protected]
61+
RUN arduino-cli lib install [email protected]
62+
RUN arduino-cli lib install [email protected]
63+
RUN arduino-cli lib install "SdFat"@2.1.1
64+
RUN arduino-cli lib install "SparkFun LIS2DH12 Arduino Library"@1.0.3
65+
RUN arduino-cli lib install "SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
66+
RUN arduino-cli lib install "SparkFun u-blox GNSS v3"@3.0.14
67+
RUN arduino-cli lib install "SparkFun_WebServer_ESP32_W5500"@1.5.5
68+
RUN arduino-cli lib install "SparkFun Qwiic OLED Arduino Library"@1.0.13
69+
RUN arduino-cli lib install [email protected]
70+
71+
# Enable external libs
72+
RUN arduino-cli config set library.enable_unsafe_install true
73+
74+
# Get external libs
75+
RUN arduino-cli lib install --git-url https://github.com/me-no-dev/ESPAsyncWebServer.git
76+
RUN arduino-cli lib install --git-url https://github.com/me-no-dev/AsyncTCP.git
77+
78+
# Copy RTK_Everywhere into /work and build deployment image
79+
FROM upstream AS deployment
80+
81+
# Create work directory
82+
WORKDIR /work
83+
ADD . .
84+
85+
# Get current date
86+
#RUN echo "$(date +'%b_%d_%Y')" > date_scores.txt
87+
#RUN DATE_SCORES=$(cat date_scores.txt) && echo "Date: ${DATE_SCORES}"
88+
#RUN echo "$(date +'%b %d %Y')" > date_no_scores.txt
89+
#RUN DATE_NO_SCORES=$(cat date_no_scores.txt) && echo "Date: ${DATE_NO_SCORES}"
90+
91+
# Patch Server.h to avoid https://github.com/arduino-libraries/Ethernet/issues/88#issuecomment-455498941
92+
WORKDIR /work/RTK_Surveyor/Patch
93+
RUN cp Server.h "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/cores/esp32/Server.h"
94+
95+
# Update form.h with index_html and main_js
96+
WORKDIR /work/Tools
97+
RUN python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h
98+
RUN python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h
99+
100+
# Copy custom app3M_fat9M_16MB.csv
101+
WORKDIR /work
102+
RUN cp app3M_fat9M_16MB.csv "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/tools/partitions/app3M_fat9M_16MB.csv"
103+
104+
# Compile Sketch
105+
WORKDIR /work/RTK_Surveyor
106+
RUN arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${DEBUG_LEVEL} \
107+
./RTK_Surveyor.ino \
108+
--build-property build.partitions=app3M_fat9M_16MB \
109+
--build-property upload.maximum_size=3145728 \
110+
--build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECTTOKEN=${POINTPERFECT_TOKEN}\" \
111+
\"-DFIRMWARE_VERSION_MAJOR=${FIRMWARE_VERSION_MAJOR}\" \
112+
\"-DFIRMWARE_VERSION_MINOR=${FIRMWARE_VERSION_MINOR}\" \
113+
\"-DENABLE_DEVELOPER=${ENABLE_DEVELOPER}\"" \
114+
--export-binaries
115+
116+
# Copy the compile output. List the files
117+
FROM deployment AS output
118+
COPY --from=deployment /work/RTK_Surveyor/build/esp32.esp32.esp32 /
119+
CMD echo $(ls /*.*)

Firmware/RTK_Surveyor/AP-Config/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@
14031403

14041404
<div class="form-group row">
14051405
<label for="pvtClientPort" class="box-margin20 col-sm-3 col-4 col-form-label">Port:
1406-
<span class="tt" data-bs-placement="right" title="TCP port to use. Default: 2947">
1406+
<span class="tt" data-bs-placement="right" title="TCP port to use. Default: 2948">
14071407
<span class="icon-info-circle text-primary ms-2"></span>
14081408
</span>
14091409
</label>
@@ -1430,7 +1430,7 @@
14301430
<div id="tcpServerSettingsConfig">
14311431
<div class="form-group row">
14321432
<label for="pvtServerPort" class="box-margin20 col-sm-3 col-4 col-form-label">Port:
1433-
<span class="tt" data-bs-placement="right" title="TCP port to use. Default: 2947">
1433+
<span class="tt" data-bs-placement="right" title="TCP port to use. Default: 2948">
14341434
<span class="icon-info-circle text-primary ms-2"></span>
14351435
</span>
14361436
</label>

Firmware/RTK_Surveyor/AP-Config/src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ function tcpClientBoxes() {
16121612
}
16131613
else {
16141614
hide("tcpClientSettingsConfig");
1615-
//ge("pvtClientPort").value = 2947;
1615+
//ge("pvtClientPort").value = 2948;
16161616
}
16171617
}
16181618

@@ -1622,7 +1622,7 @@ function tcpServerBoxes() {
16221622
}
16231623
else {
16241624
hide("tcpServerSettingsConfig");
1625-
//ge("pvtServerPort").value = 2947;
1625+
//ge("pvtServerPort").value = 2948;
16261626
}
16271627
}
16281628

Firmware/RTK_Surveyor/Display.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2988,7 +2988,7 @@ void displayMessageFont(const char *message, uint16_t displayTime, bool smallFon
29882988
{
29892989
if (online.display == true)
29902990
{
2991-
char temp[21];
2991+
char temp[threeLinesOfText];
29922992
uint8_t fontHeight = 16; // Assume fontsize 1
29932993
if (smallFont)
29942994
fontHeight = 10;

Firmware/RTK_Surveyor/PvtServer.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ void paintPvtServerIP()
609609
if (network)
610610
localIp = networkGetIpAddress(network->type);
611611

612-
char message[31];
612+
char message[threeLinesOfText];
613613

614614
snprintf(message, sizeof(message), "%d.%d. %d.%d: %d",
615615
localIp[0], localIp[1], localIp[2], localIp[3],

Firmware/RTK_Surveyor/PvtUdpServer.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ void paintUdpServerIP()
388388
if (network)
389389
localIp = networkGetIpAddress(network->type);
390390

391-
char message[31];
391+
char message[threeLinesOfText];
392392

393393
snprintf(message, sizeof(message), "%d.%d. %d.%d: %d",
394394
localIp[0], localIp[1], localIp[2], localIp[3],

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ const uint8_t btMaxEscapeCharacters = 3; // Number of characters needed to enter
482482
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
483483
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
484484

485+
const int threeLinesOfText = 31; // char array size for three lines of text
486+
485487
#if COMPILE_NETWORK
486488
bool pvtServerRunning(); // Header
487489
bool pvtUdpServerRunning(); // Header

Firmware/RTK_Surveyor/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ typedef struct
11921192
bool debugPvtServer = false;
11931193
bool enablePvtServer = false;
11941194
uint16_t pvtServerPort = 2948; // PVT server port, 2948 is GPS Daemon: http://tcp-udp-ports.com/port-2948.htm
1195-
bool displayServerIP = true;
1195+
bool displayServerIP = true; // Also used by UDP Server
11961196

11971197
// UDP Server
11981198
bool debugPvtUdpServer = false;

Firmware/compile_with_docker.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
docker build -t rtk_firmware --no-cache-filter deployment .
2+
docker create --name=rtk_container rtk_firmware:latest
3+
docker cp rtk_container:/RTK_Surveyor.ino.bin .
4+
docker cp rtk_container:/RTK_Surveyor.ino.elf .
5+
docker cp rtk_container:/RTK_Surveyor.ino.bootloader.bin .
6+
docker container rm rtk_container

0 commit comments

Comments
 (0)