Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/inst

RUN arduino-cli config init

# aloow unsafe sources (zip, git)
# allow unsafe sources (zip, git)
RUN arduino-cli config set library.enable_unsafe_install true

# update arduino-cli
Expand All @@ -29,14 +29,20 @@ RUN arduino-cli lib install --zip-path HDC100X.zip
RUN arduino-cli lib install --zip-path Makerblog_TSL45315.zip
RUN arduino-cli lib install --zip-path VEML6070.zip
RUN arduino-cli lib install --zip-path LTR329.zip
RUN arduino-cli lib install --zip-path sps30.zip
RUN arduino-cli lib install --git-url https://github.com/sensebox/SDS011-select-serial

# install arduino stuff for senseBox V2
RUN arduino-cli core install arduino:[email protected]
RUN curl -o /root/.arduino15/package_sensebox_index.json https://raw.githubusercontent.com/sensebox/senseBoxMCU-core/master/package_sensebox_index.json
RUN arduino-cli --additional-urls https://raw.githubusercontent.com/sensebox/senseBoxMCU-core/master/package_sensebox_index.json core install sensebox:samd


# RUN arduino-cli lib install --zip-path sps30.zip // SPS30 is not an official part of sensebox home yet

# TODO: the following lines can be removed, as soon as they were added into the sensebox samd package
RUN arduino-cli lib install RG15-Arduino
RUN arduino-cli lib install SolarChargerSB041

WORKDIR /app

COPY package.json /app
Expand Down
162 changes: 100 additions & 62 deletions arduino-test/build-sketches.js
Original file line number Diff line number Diff line change
@@ -1,98 +1,124 @@
'use strict';
"use strict";

const fs = require('fs');
const child_process = require('child_process');
const fs = require("fs");
const child_process = require("child_process");

const SketchTemplater = require('../src');
const SketchTemplater = require("../src");

const sketchTemplater = new SketchTemplater('test.ingress.domain');
const sketchTemplater = new SketchTemplater("test.ingress.domain");

const boxStub = function (model) {
return {
_id: '59479ed5a4ad5900112d8dec',
name: 'Teststation',
_id: "59479ed5a4ad5900112d8dec",
name: "Teststation",
model: model,
sensors: [
{
title: 'Temperatur',
_id: '59479ed5a4ad5900112d8ded',
sensorType: 'HDC1080'
title: "Temperatur",
_id: "59479ed5a4ad5900112d8ded",
sensorType: "HDC1080",
},
{
title: 'rel. Luftfeuchte',
_id: '59479ed5a4ad5900112d8dee',
sensorType: 'HDC1080'
title: "rel. Luftfeuchte",
_id: "59479ed5a4ad5900112d8dee",
sensorType: "HDC1080",
},
{
title: 'Luftdruck',
_id: '59479ed5a4ad5900112d8def',
sensorType: 'BMP280'
title: "Luftdruck",
_id: "59479ed5a4ad5900112d8def",
sensorType: "BMP280",
},
{
title: 'Beleuchtungsstärke',
_id: '59479ed5a4ad5900112d8df0',
sensorType: 'TSL45315'
title: "Beleuchtungsstärke",
_id: "59479ed5a4ad5900112d8df0",
sensorType: "TSL45315",
},
{
title: 'UV-Intensität',
_id: '59479ed5a4ad5900112d8df1',
sensorType: 'VEML6070'
title: "UV-Intensität",
_id: "59479ed5a4ad5900112d8df1",
sensorType: "VEML6070",
},
{ title: 'PM10', _id: '59479ed5a4ad5900112d8df2', sensorType: 'SDS 011' },
{ title: "PM10", _id: "59479ed5a4ad5900112d8df2", sensorType: "SDS 011" },
{
title: 'PM2.5',
_id: '59479ed5a4ad5900112d8df3',
sensorType: 'SDS 011'
title: "PM2.5",
_id: "59479ed5a4ad5900112d8df3",
sensorType: "SDS 011",
},
{
title: 'Bodenfeuchte',
_id: '59479ed5a4ad5900112d8df4',
sensorType: 'SMT50'
title: "Bodenfeuchte",
_id: "59479ed5a4ad5900112d8df4",
sensorType: "SMT50",
},
{
title: 'Bodentemperatur',
_id: '59479ed5a4ad5900112d8df5',
sensorType: 'SMT50'
title: "Bodentemperatur",
_id: "59479ed5a4ad5900112d8df5",
sensorType: "SMT50",
},
{
title: 'Lufttemperatur',
_id: '59479ed5a4ad5900112d8df6',
sensorType: 'BME680'
title: "Lufttemperatur",
_id: "59479ed5a4ad5900112d8df6",
sensorType: "BME680",
},
{
title: 'Luftfeuchtigkeit',
_id: '59479ed5a4ad5900112d8df7',
sensorType: 'BME680'
title: "Luftfeuchtigkeit",
_id: "59479ed5a4ad5900112d8df7",
sensorType: "BME680",
},
{
title: 'atm. Luftdruck',
_id: '59479ed5a4ad5900112d8df8',
sensorType: 'BME680'
title: "atm. Luftdruck",
_id: "59479ed5a4ad5900112d8df8",
sensorType: "BME680",
},
{ title: 'VOC', _id: '59479ed5a4ad5900112d8df9', sensorType: 'BME680' },
{ title: "VOC", _id: "59479ed5a4ad5900112d8df9", sensorType: "BME680" },
{
title: 'Lautstärke',
_id: '59479ed5a4ad5900112d8dd0',
sensorType: 'SoundLevelMeter'
}
title: "Lautstärke",
_id: "59479ed5a4ad5900112d8dfa",
sensorType: "SoundLevelMeter",
},
{
title: "Gesamtniederschlag",
_id: "59479ed5a4ad5900112d8dfb",
sensorType: "RG15",
},
{
title: "Niederschlagsintensität",
_id: "59479ed5a4ad5900112d8dfb",
sensorType: "RG15",
},
{
title: "Solarspannung",
_id: "59479ed5a4ad5900112d8dfc",
sensorType: "SB041",
},
{
title: "Batteriespannung",
_id: "59479ed5a4ad5900112d8dfc",
sensorType: "SB041",
},
{
title: "Ladelevel", //TODO eigentlich "Batterielevel", aber geht nicht, da erste 6 Buchstaben identisch zu "Batteriespannung"
_id: "59479ed5a4ad5900112d8dfc",
sensorType: "SB041",
},
],
serialPort: 'Serial1',
ssid: 'MY-HOME-NETWORK',
password: 'MY-SUPER-PASSWORD',
display_enabled: 'true'
sdsSerialPort: "Serial1",
rg15SerialPort: "Serial2",
ssid: "MY-HOME-NETWORK",
password: "MY-SUPER-PASSWORD",
display_enabled: "true",
};
};

const buildMatrix = {
'arduino:avr:uno': [],
'sensebox:samd:sb': []
"arduino:avr:uno": [],
"sensebox:samd:sb": [],
};

for (const model of Object.keys(sketchTemplater._templates)) {
if (model.includes('V2')) {
buildMatrix['sensebox:samd:sb'].push(model);
if (model.includes("V2")) {
buildMatrix["sensebox:samd:sb"].push(model);
} else {
buildMatrix['arduino:avr:uno'].push(model);
buildMatrix["arduino:avr:uno"].push(model);
}
}

Expand All @@ -113,12 +139,24 @@ const build = function build(board, model) {
console.log(
`Building model ${model} with "arduino-cli compile --fqbn ${board} ${sketchesPath}/${model}/${model}.ino"`
);
child_process.execSync(
`arduino-cli compile --fqbn ${board} -e ${sketchesPath}/${model}/${model}.ino`,
// `arduino --verbose-build --verify --board ${board} ${sketchesPath}/${model}/${model}.ino`,
{ stdio: [0, 1, 2] }
);
console.log('###########################################################');
try {
child_process.execSync(
`arduino-cli compile --fqbn ${board} -e ${sketchesPath}/${model}/${model}.ino`,
// `arduino --verbose-build --verify --board ${board} ${sketchesPath}/${model}/${model}.ino`,
{ stdio: "inherit" }
);
console.log("Compilation success!");
console.log("###########################################################");
} catch (error) {
console.log("Compilation failed!");
if (error.stdout) {
console.error("Standard Output (stdout):", error.stdout.toString());
}
if (error.stderr) {
console.error("Standard Error (stderr):", error.stderr.toString());
}
console.log("###########################################################");
}
};

const sketchesPath = `${__dirname}/sketches`;
Expand All @@ -129,4 +167,4 @@ for (const board of Object.keys(buildMatrix)) {
build(board, model);
}
}
console.log('done');
console.log("done");
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ void loop() {
display.setTextColor(WHITE, BLACK);
switch (page)
{
case 0:
case 0:
// HDC & BMP
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
Expand Down Expand Up @@ -602,7 +602,7 @@ void loop() {
display.println(F("not connected"));
#endif
break;
case 1:
case 1:
// TSL/VEML
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
Expand All @@ -623,20 +623,21 @@ void loop() {
#else
display.println(F("not connected"));
#endif
case 2:
// SDS
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
display.println(F("PM10&PM25"));
display.setTextColor(WHITE, BLACK);
display.println();
display.setTextSize(1);
display.print(F("PM10:"));
display.println(pm10);
display.print(F("PM25:"));
display.println(pm25);
break;
case 3:
break;
case 2:
// SDS
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
display.println(F("PM10&PM25"));
display.setTextColor(WHITE, BLACK);
display.println();
display.setTextSize(1);
display.print(F("PM10:"));
display.println(pm10);
display.print(F("PM25:"));
display.println(pm25);
break;
case 3:
// Soil
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
Expand All @@ -659,7 +660,7 @@ void loop() {
#endif

break;
case 4:
case 4:
// WINDSPEED SCD30
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
Expand All @@ -681,7 +682,7 @@ void loop() {
display.println(F("not connected"));
#endif
break;
case 5:
case 5:
//SOUND LEVEL , BME
display.setTextSize(2);
display.setTextColor(BLACK, WHITE);
Expand Down Expand Up @@ -802,4 +803,4 @@ unsigned int Lightsensor_getIlluminance()
}
return lux;
}
#endif
#endif
Loading
Loading