Skip to content

Commit

Permalink
Merge pull request #20 from EdgePi-Cloud/dev-fix-adc-inputs
Browse files Browse the repository at this point in the history
fix default empty inputs
  • Loading branch information
jimmy121192 authored Jan 22, 2024
2 parents fb97ab8 + ae41f4a commit d4a374a
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 50 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/create-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will create a new tag based on latest commit to branch

name: Create Release Tag

on:
push:
branches:
- main

jobs:
build-and-publish:
name: Create Release Tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
- name: Get Current Version
run: echo "current_version=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Create Release Tag
env:
commit_name: bot-edgepi
commit_email: bot@edgepi.com
username: bot-edgepi
run: |
git config user.name ${{ env.commit_name }}
git config user.email ${{ env.commit_email }}
git tag -a release/v${{ env.current_version }} -m "tag release version ${{ env.current_version }}"
git push origin release/v${{ env.current_version }}
15 changes: 12 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- main
tags:
- release/*
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,7 +15,14 @@ jobs:
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --access public

- name: Publish Package to npm
run: |
npm ci
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }

- name: Release Package
uses: ncipollo/release-action@v1.12.0

2 changes: 1 addition & 1 deletion .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14 # Adjust this to your desired Node.js version
node-version: 16 # Adjust this to your desired Node.js version

- name: Set Git user information
run: |
Expand Down
18 changes: 10 additions & 8 deletions edgepi-adc.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
return this.name || "adc";
},
oneditprepare: function () {
const configTransportSelect = document.getElementById(
"node-input-transport"
);
const tcpField = document.querySelector(".form-row.tcp");
const transportType = document.getElementById("node-input-transport");
const tcpTransportInputs = document.querySelector(".form-row.tcp");
const read = document.getElementById("node-input-read");
const adcNum = document.getElementById("node-input-adcNum");
const adc1 = document.getElementById("adc-option-adc1");
Expand All @@ -35,8 +33,8 @@
const diffField = document.querySelector(".form-row.diff");

function updateEditor() {
tcpField.style.display =
configTransportSelect.value === "Network" ? "flex" : "none";
tcpTransportInputs.style.display =
transportType.value === "Network" ? "flex" : "none";
channelField.style.display = read.value === "single" ? "flex" : "none";
dataRateField.style.display = read.value === "single" ? "flex" : "none";
diffField.style.display = read.value === "diff" ? "flex" : "none";
Expand All @@ -51,7 +49,7 @@
}
}
updateEditor();
configTransportSelect.addEventListener("change", updateEditor);
transportType.addEventListener("change", updateEditor);
read.addEventListener("change", updateEditor);
adcNum.addEventListener("change", updateEditor);
},
Expand Down Expand Up @@ -210,7 +208,11 @@ <h3>Details</h3>
<h3>Properties</h3>
<dl class="message-properties">
<dt>RPC Server</dt>
<dd>The connection to your EdgePi's RPC Server.</dd>
<dd>
The connection to your EdgePi's RPC Server. Use <strong>Local</strong> if
node-red is running on EdgePi. Otherwise use the
<strong>Network</strong> option and enter EdgePi's IP address / Hostname.
</dd>
</dl>
<dl class="message-properties">
<dt>Read</dt>
Expand Down
3 changes: 2 additions & 1 deletion edgepi-adc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ module.exports = async function (RED) {
node.on("input", async function (msg, send, done) {
node.status({ fill: "green", shape: "dot", text: "input received" });
try {
read = msg.readType || read; //prioritize the inputs in the msg
read = msg.readType || read;
adcNum = msg.adc || adcNum;
inputSelection = msg.payload || inputSelection;
dataRate = msg.dataRate || dataRate;

if (read !== "rtd") {
await adc.setRtd(false, adcNum - 1);
}
Expand Down
74 changes: 38 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"node-red": "^3.1.3"
},
"dependencies": {
"@edgepi-cloud/edgepi-rpc": "^1.1.0"
"@edgepi-cloud/edgepi-rpc": "^1.1.1"
}
}

0 comments on commit d4a374a

Please sign in to comment.