Compare commits

...

23 Commits

Author SHA1 Message Date
323c1ab6a9 Dockerfile aktualisiert
All checks were successful
Build and push image / build (push) Successful in 20m6s
2024-02-06 17:11:49 +00:00
d71926b967 package.json aktualisiert
Some checks failed
Build and push image / build (push) Failing after 19m50s
2024-02-06 15:17:21 +00:00
ab1578e5b0 .gitea/workflows/build.yaml aktualisiert
Some checks failed
Build and push image / build (push) Has been cancelled
2024-02-06 00:02:36 +00:00
Simon Zeyer
1edf238a6b rename folder structure 2024-02-05 23:25:03 +00:00
6cdb2c8e81 .gitea / workflows / build.yaml aktualisiert 2024-02-05 23:13:36 +00:00
42e3718fea Merge pull request '.gitea / workflows / build.yaml hinzugefügt' (#2) from feature/sz/build-actions-runner into master
Reviewed-on: #2
2024-02-05 23:11:26 +00:00
6eb9293879 .gitea / workflows / build.yaml hinzugefügt 2024-02-05 23:10:00 +00:00
681b36c34d revert de6af2d8cc48276a1b393b5ab6a6ba278bf4f761
revert Merge pull request 'feature/sz/build-actions-runner' (#1) from feature/sz/build-actions-runner into master

Reviewed-on: #1
2024-02-05 23:08:23 +00:00
de6af2d8cc Merge pull request 'feature/sz/build-actions-runner' (#1) from feature/sz/build-actions-runner into master
Reviewed-on: #1
2024-02-05 23:07:05 +00:00
2b11b9399b .github/ISSUE_TEMPLATE/build.yaml aktualisiert 2024-02-05 23:05:59 +00:00
dd8c615cd0 .github/ISSUE_TEMPLATE/build.yaml hinzugefügt 2024-02-05 23:00:48 +00:00
Your Name
0f47977804 multistage build, with docker compose 2023-07-03 21:54:01 +00:00
Your Name
d479f7afd0 init docker compose 2023-07-03 20:41:05 +00:00
Your Name
4d28340061 Dockerfile for building Application 2023-07-03 20:34:51 +00:00
Your Name
65184855e2 Ver01072023 2023-07-03 20:19:09 +00:00
Mario Pesch
20652daf92
Merge pull request #241 from sensebox/fix/update-bsec-code
update bsec code
2023-05-11 14:30:23 +02:00
Mario Pesch
ebd945711a update bsec code
update bsec code due to breaking changes in latest library version
2023-05-11 14:16:10 +02:00
Mario Pesch
a969727a48
Merge pull request #240 from sensebox/fix/alway-include-senseboxIO
add senseBoxIO to main procedure
2023-05-08 14:26:01 +02:00
Mario Pesch
a1167b436b add senseBoxIO to main procedure 2023-05-08 14:20:25 +02:00
Mario Pesch
7524e78fc6
Merge pull request #239 from sensebox/development
Development
2023-04-03 12:46:22 +02:00
Mario Pesch
f8cfb6691b
Merge pull request #238 from sensebox/dev/update-mini-ports
update ports for senseBox MCU mini
2023-04-03 12:39:04 +02:00
Mario Pesch
abce42f764
Merge pull request #237 from sensebox/dev/button_asSwitch
add Button as Switch
2023-04-03 12:35:07 +02:00
Mario Pesch
7c60869124 add Button as Switch 2023-04-03 12:26:43 +02:00
13 changed files with 234 additions and 1 deletions

View File

@ -0,0 +1,41 @@
name: Build and push image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
#defaults:
# run:
# working-directory: /repo
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # all history for all branches and tags
- name: Login to gitea.simonzeyer.de Repo
uses: docker/login-action@v2
with:
registry: gitea.simonzeyer.de
username: ${{ secrets.DOCKER_REPO_USER }}
password: ${{ secrets.DOCKER_REPO_PASSWD }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
with:
context: .
file: ./Dockerfile
push: true
tags: |
gitea.simonzeyer.de/schuelerlabor-cleverlab/smarti:${{ steps.meta.outputs.REPO_VERSION }}

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
# specify the node base image with your desired version node:<version>
FROM node:16 as build
WORKDIR /app
copy ./ /app
RUN npm install --verbose
RUN npm run build --verbose
FROM nginx:alpine
COPY --from=build /app/build/ /usr/share/nginx/html
RUN chmod 755 /usr/share/nginx/html/ -R
EXPOSE 80
ENTRYPOINT ["sh", "-c", "cd /usr/share/nginx/html/ && nginx -g 'daemon off;'"]

11
docker-compose.yaml Normal file
View File

@ -0,0 +1,11 @@
# docker-compose.yml
services:
smarti:
mem_limit: 2048m
mem_reservation: 128M
cpus: 2
build:
dockerfile: Dockerfile
ports:
- "80"

View File

@ -70,5 +70,8 @@
">0.2%",
"not dead",
"not op_mini all"
]
],
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11"
}
}

View File

@ -0,0 +1,88 @@
import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
import { selectedBoard } from "../helpers/board";
import { FieldGridDropdown } from "@blockly/field-grid-dropdown";
/**
* DS18B20 Temperatursonde
*
*/
Blockly.Blocks["CleVerLab_dummy1"] = {
init: function () {
this.setColour(getColour().cleverlab);
this.appendDummyInput()
.appendField("tut nichts")
this.setOutput(true, Types.NUMBER.typeName);
this.data = {name: "empty"};
},
};
Blockly.Blocks["CleVerLab_temperature"] = {
init: function () {
this.setColour(getColour().cleverlab);
this.appendDummyInput()
.appendField("Temperatur")
.appendField("Digital Port:")
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "DigitalPin");
this.setOutput(true, Types.NUMBER.typeName);
this.data = {name: "ds18b20"};
},
};
/**
* PH Wert
*
*/
Blockly.Blocks["CleVerLab_pH"] = {
init: function () {
this.setColour(getColour().cleverlab);
this.appendDummyInput()
.appendField("pH Wert")
.appendField("Digital Port:")
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPins), "DigitalPin");
this.setOutput(true, Types.NUMBER.typeName);
this.data = {name: "phoderso"};
},
};
Blockly.Blocks["CleVerLab_cali1"] = {
init: function () {
this.appendDummyInput()
.appendField("Kalibriere pH Sensor");
this.appendValueInput("VAR1", "Number")
.appendField("Referenzlösung pH 4.00 =")
.setAlign(Blockly.ALIGN_RIGHT);
this.appendValueInput("VAR2", "Number2")
.appendField("Referenzlösung pH 7.00 =")
.setAlign(Blockly.ALIGN_RIGHT);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().cleverlab);
this.setOutput(true, Types.NUMBER.typeName);
this.data = {name: "dsasda"};
},
};
/**
* Pump
*
*/
Blockly.Blocks['CleVerLab_pump'] = {
init: function() {
this.setColour(getColour().cleverlab);
var dropdown = new Blockly.FieldDropdown([
[ 'START','HIGH'],
[ 'STOPP','LOW']
]);
this.appendDummyInput()
.appendField(dropdown, "Mode")
.appendField(" Pumpe ")
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPins), "DigitalPin");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
//this.setOutput(true, "Number");
this.setTooltip('');
this.setHelpUrl('');
}
};

View File

@ -26,5 +26,6 @@ import "./variables";
import "./lists";
import "./watchdog";
import "./webserver";
import "./CleVerLab"
import "../helpers/types";

View File

@ -331,6 +331,7 @@ Blockly.Blocks["sensebox_button"] = {
[Blockly.Msg.senseBox_button_isPressed, "isPressed"],
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
[Blockly.Msg.senseBox_button_longPress, "longPress"],
[Blockly.Msg.senseBox_button_switch,"toggleButton"]
]),
"FUNCTION"
)

View File

@ -0,0 +1,61 @@
import Blockly from "blockly";
/**
* starte/stoppe Pumpe
*
*/
Blockly.Arduino.CleVerLab_pump = function (block) {
var pin = block.getFieldValue('DigitalPin');
var state = block.getFieldValue("Mode");
Blockly['Arduino'].setupCode_['pinMode'] = 'pinMode(' + pin + ', OUTPUT);';
var code = 'digitalWrite(' + pin + ', ' + state + ');\n';
return code;
};
/**
* PH wert
*
*/
Blockly.Arduino.CleVerLab_temperature = function () {
var dropdown_pin = this.getFieldValue("DigitalPort");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_oneWire"] =
"#include <OneWire.h> // http://librarymanager/All#OneWire";
Blockly.Arduino.libraries_["library_oneDallasTemperature"] =
"#include <DallasTemperature.h> // http://librarymanager/All#DallasTemperature";
Blockly.Arduino.definitions_["define_OneWire"] =
"#define ONE_WIRE_BUS " +
dropdown_pin +
"\nOneWire oneWire(ONE_WIRE_BUS);\nDallasTemperature sensors(&oneWire);";
Blockly.Arduino.setupCode_["sensebox_oneWireSetup"] = "sensors.begin();";
Blockly.Arduino.codeFunctions_["sensebox_requestTemp"] =
"float getWaterTemp(){\nsensors.requestTemperatures();\nsensors.getTempCByIndex(0);\n}";
var code = "getWaterTemp()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.CleVerLab_pH = function () {
var dropdown_pin = this.getFieldValue("DigitalPin");
Blockly.Arduino.definitions_["define_pHgetter"] =
"#define SensorPin " + dropdown_pin +"\n#define samplingInterval 20\n#define printInterval 800\n#define ArrayLenth 40 //times of collection\nint pHArray[ArrayLenth]; //Store the average value of the sensor feedback\nint pHArrayIndex=0;\nfloat slope = 1.00;\nfloat b =0.00;";
Blockly.Arduino.codeFunctions_["sensebox_requestpH"] =
"float getpH(){\nstatic unsigned long samplingTime = millis();\nstatic unsigned long printTime = millis();\nstatic float pHValue,voltage;\n//nif(millis()-samplingTime > samplingInterval){\n//pHArray[pHArrayIndex++]=analogRead(SensorPin);\nfor (int i = 1; i <= 10; i += 1) {\nvoltage = voltage + analogRead(SensorPin);\n}\n voltage = (voltage / 10)*5.0/1024; \nsamplingTime=millis();\n\nreturn pHValue = 3.5*voltage*slope+b;\n}\n";
Blockly.Arduino.codeFunctions_["avergearraypH"] =
"double avergearray(int* arr, int number) {\n int i;\n int max, min;\n double avg;\n long amount = 0;\n if (number <= 0) {\n return 0;\n }\n if (number < 5) {\n for (i = 0; i < number; i++) {\n amount += arr[i];\n }\n avg = amount / number;\n return avg;\n }\n else {\n if (arr[0] < arr[1]) {\n min = arr[0];\n max = arr[1];\n }\n else {\n min = arr[1];\n max = arr[0];\n }\n for (i = 2; i < number; i++) {\n if (arr[i] < min) {\n amount += min;\n min = arr[i];\n }\n else {\n if (arr[i] > max) {\n amount += max;\n max = arr[i];\n }\n else {\n amount += arr[i];\n }\n }\n }\n avg = (double)amount / (number - 2);\n }\n return avg;\n}";
var code = "getpH()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.CleVerLab_cali1 = function () {
var var1 = Blockly.Arduino.valueToCode(this, 'VAR1', Blockly.Arduino.ORDER_ATOMIC) || "4.00";
var var2 = Blockly.Arduino.valueToCode(this, 'VAR2', Blockly.Arduino.ORDER_ATOMIC) || "7.00";
//var var1 = this.getFieldValue("VAR1");
//var var2 = this.getFieldValue("VAR2");
Blockly.Arduino.definitions_["define_pHKali"] = "#define pH4 4.00\n#define pH7 7.00\nfloat pH4is = "+ var1+";\nfloat pH7is = "+ var2 +";";
Blockly.Arduino.setupCode_["asdsadsa"] ="slope = (2.00-(4.00/3.50))/(pH7is/3.50 - pH4is/3.50);\n b = 7 - (pH7is * slope);";
var code = "0";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

View File

@ -27,3 +27,4 @@ import "./variables";
import "./lists";
import "./watchdog";
import "./webserver";
import "./CleVerLab"

View File

@ -399,6 +399,7 @@ Blockly.Arduino.sensebox_button = function () {
Blockly.Arduino.libraries_[
"library_jcButtons"
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
@ -413,6 +414,10 @@ Blockly.Arduino.sensebox_button = function () {
} else if (dropown_function === "longPress") {
var time = this.getFieldValue("time");
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
} else if (dropown_function === "toggleButton") {
code = "button_" + dropdown_pin + ".toggleState()";
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
"ToggleButton button_" + dropdown_pin + "(" + dropdown_pin + ");";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

View File

@ -15,6 +15,7 @@ const colours = {
webserver: 40,
phyphox: 25,
motors: 190,
cleverlab: 185 ,
};
export const getColour = () => {

View File

@ -0,0 +1,3 @@
export const CLEVERLAB = {
}

View File

@ -633,6 +633,11 @@ class Toolbox extends React.Component {
colour={getColour().procedures}
custom="PROCEDURE"
></Category>
<Category name="CleVerLab" colour={getColour().cleverlab}>
<Block type="CleVerLab_pH" />
<Block type="CleVerLab_pump" />
<Block type="CleVerLab_cali1" />
</Category>
<Category name={Blockly.Msg.toolbox_advanced} colour={getColour().io}>
<Category
name={Blockly.Msg.toolbox_serial}