Skip to content

Commit

Permalink
Merge pull request #696 from chaotixkilla/fix-tejo-scripts
Browse files Browse the repository at this point in the history
Fix Tejo related scripts
  • Loading branch information
RafaelTaranto authored Oct 14, 2021
2 parents 97f8433 + 68ca9cf commit e4e87e8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
17 changes: 9 additions & 8 deletions bin/dispense-f56-multi.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const f56 = require('./multi-cassette/f56-rs232-multi')
const deviceConfig = require('../device-config.json')
const deviceConfig = require('../device_config.json')

if (deviceConfig.cryptomatModel !== 'tejo') {
console.log('This script can only be run on setup Tejo devices')
Expand Down Expand Up @@ -32,10 +32,11 @@ for (let i = 3; i < 3 + parseInt(deviceConfig.billDispenser.cassettes); i++) {
}

f56.create(process.argv[2])
.then(() => f56.billCount(bills))
.then(res => console.dir(res))
.then(() => process.exit(0))
.catch(e => {
console.log(e)
process.exit(1)
})
.then(() => f56.initialize('EUR', [5, 10, 20, 50]))
.then(() => f56.billCount(bills))
.then(res => console.dir(res))
.then(() => process.exit(0))
.catch(e => {
console.log(e)
process.exit(1)
})
18 changes: 9 additions & 9 deletions bin/dispense-init-f56-multi.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const f56 = require('./multi-cassette/f56-rs232-multi')
const deviceConfig = require('../device-config.json')
const deviceConfig = require('../device_config.json')

if (deviceConfig.cryptomatModel !== 'tejo') {
console.log('This script can only be run on setup Tejo devices')
Expand Down Expand Up @@ -32,11 +32,11 @@ for (let i = 3; i < 3 + parseInt(deviceConfig.billDispenser.cassettes); i++) {
}

f56.create(process.argv[2])
.then(() => f56.initialize('EUR', denominations))
.then(res => console.dir(res))
.then(() => process.exit(0))
.catch(e => {
console.log('DEBUG1')
console.log(e)
process.exit(1)
})
.then(() => f56.initialize('EUR', denominations))
.then(res => console.dir(res))
.then(() => process.exit(0))
.catch(e => {
console.log('DEBUG1')
console.log(e)
process.exit(1)
})
4 changes: 2 additions & 2 deletions bin/set-tejo-cassettes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (deviceConfig.cryptomatModel !== 'tejo') {
process.exit(2)
}

if (process.argv.length !== 2) {
if (process.argv.length !== 3) {
console.log('Usage: node bin/set-tejo-cassettes.js <number of cassettes>')
console.log('Ex: node bin/set-tejo-cassettes.js 3')
process.exit(2)
Expand All @@ -22,4 +22,4 @@ if (process.argv[2] > 4 || process.argv[2] < 2) {

deviceConfig.billDispenser.cassettes = process.argv[2]

fs.writeFileSync(path.join(__dirname, 'device_config.json'), JSON.stringify(deviceConfig))
fs.writeFileSync(path.join(process.cwd(), 'device_config.json'), JSON.stringify(deviceConfig, null, 2))
6 changes: 5 additions & 1 deletion tools/led-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ const ledManager = process.argv[2] === 'gaia' ?
:
require('../lib/ssuboard/led-manager')

const ledAddresses = process.argv[2] === 'tejo'
? require('../lib/upboard/tejo/led-addresses')
: null

function emit (subsystem, action) {
return () => actionEmitter.emit(subsystem, {action})
}

ledManager.run()
ledManager.run(ledAddresses)
.then(emit('brain', 'billValidatorPending'))
.then(() => delay(3000))
.then(emit('brain', 'billValidatorAccepting'))
Expand Down

0 comments on commit e4e87e8

Please sign in to comment.