Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
feat: pull EVENT_MARKER_PRODUCT_ID from env if available
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmcgrath13 committed Nov 11, 2019
1 parent ba1ce93 commit d56eba3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions public/config/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const productId = '0487'
// Make sure the 'open_resting_task' value doesn't conflict with any value sent
// by any other task, since we use it to uniquely identify this task. It's ok
// for other values to be re-used in other tasks.

// NOTE - these must match the codes in src/config/trigger.js
const eventCodes = {
'test_connect': 32,
'open_task': 12,
Expand Down
6 changes: 5 additions & 1 deletion public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const { eventCodes, manufacturer, vendorId, productId } = require('./config/trig
const { isPort, getPort, sendToPort } = require('event-marker')
log.info(AT_HOME)

// Override product ID if environment variable set
const activeProductId = process.env.EVENT_MARKER_PRODUCT_ID || productId
log.info("Active product ID", activeProductId)

// Data Saving
const { dataDir } = require('./config/saveData')

Expand Down Expand Up @@ -80,7 +84,7 @@ let portAvailable
let SKIP_SENDING_DEV = false

const setUpPort = async () => {
p = await getPort(vendorId, productId)
p = await getPort(vendorId, activeProductId)
if (p) {
triggerPort = p
portAvailable = true
Expand Down
7 changes: 1 addition & 6 deletions src/config/trigger.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Event trigger settings - used in both the react app (renderer) and the electron app (main)
const manufacturer = 'Teensyduino'
const vendorId = '16c0'
const productId = '0483'

// NOTE - these must match the codes in public/config/trigger.js
const eventCodes = {
'test_connect': 32,
'open_task': 12,
Expand All @@ -27,8 +25,5 @@ const eventCodes = {

// this is module.exports isntead of just exports as it is also imported into the electron app
module.exports = {
manufacturer,
vendorId,
productId,
eventCodes
}

0 comments on commit d56eba3

Please sign in to comment.