-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73f48ff
commit 0c6bf27
Showing
25 changed files
with
152 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
3 changes: 2 additions & 1 deletion
3
...ackend/backend/backend/databaseHandler.js → buildBackend/backend/databaseHandler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
3 changes: 2 additions & 1 deletion
3
buildBackend/backend/backend/misc.js → buildBackend/backend/misc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const gpio = require('onoff').Gpio; | ||
|
||
//index +1 stands for pumpid | ||
let relays; | ||
try { | ||
relays = [ | ||
new gpio(11, 'high'), | ||
new gpio(13, 'high'), | ||
new gpio(19 , 'high'), | ||
new gpio(17, 'high'), | ||
new gpio(27, 'high'), | ||
new gpio(22, 'high'), | ||
new gpio(10, 'high'), | ||
new gpio(9, 'high'), | ||
] | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
|
||
function showOnDisplay(text, removeAfter = null) { | ||
|
||
} | ||
|
||
|
||
|
||
let lastTimeoutID = [ | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
]; | ||
|
||
async function activatePump(pumpID, activateFor) { | ||
try { | ||
const pumpArrayIndex = pumpID - 1; | ||
const relay = relays[pumpArrayIndex]; | ||
if (!lastTimeoutID[pumpArrayIndex]) relay.writeSync(0); | ||
await new Promise((resolve, reject) => { | ||
clearTimeout(lastTimeoutID[pumpArrayIndex]); | ||
lastTimeoutID[pumpArrayIndex] = setTimeout(() => { | ||
lastTimeoutID[pumpArrayIndex] = null; | ||
relay.writeSync(1); | ||
resolve(); | ||
}, Math.floor(activateFor)); | ||
}); | ||
return true; | ||
} catch (e) { | ||
console.error(e); | ||
return false; | ||
} | ||
} | ||
|
||
module.exports.showOnDisplay = showOnDisplay; | ||
module.exports.activatePump = activatePump; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ | |
"startFrontend": "cd ./frontend && npm run start", | ||
"startBackend": "node ./backend/app", | ||
"start": "npm run startFrontend & npm run startBackend", | ||
"build": "rm -f -r ./buildBackend && mkdir -p ./buildBackend/backend && cp -r ./backend ./buildBackend/backend && cp -t ./buildBackend .env package.json package-lock.json" | ||
"build": "rm -f -r ./buildBackend && mkdir -p ./buildBackend/backend && cp -r ./backend/* ./buildBackend/backend && cp -t ./buildBackend .env package.json package-lock.json", | ||
"uploadBackend": "rsync --recursive --progress ./buildBackend/ [email protected]:~/Desktop/backend-server", | ||
"uploadFrontend": "rsync --recursive --progress ./frontend/build/ [email protected]:var/www/html" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"pumps":[{"id":"1","select":"Passion fruit"},{"id":"2","select":"Orange"},{"id":"3","select":"Ginger Ale"},{"id":"4","select":"Coca Cola"},{"id":"5","select":"Vodka"},{"id":"6","select":"Vodka"},{"id":"7","select":"Orange"},{"id":"8","select":"Orange"}]} | ||
{"pumps":[{"id":"1","select":"Passion fruit"},{"id":"2","select":"Orange"},{"id":"3","select":"Ginger Ale"},{"id":"4","select":"Coca Cola"},{"id":"5","select":"Vodka"},{"id":"6","select":"Vodka"},{"id":"7","select":"Orange"},{"id":"8","select":"Ginger Ale"}]} |
Oops, something went wrong.