diff --git a/public/config/trigger.js b/public/config/trigger.js index 480e024..7942816 100644 --- a/public/config/trigger.js +++ b/public/config/trigger.js @@ -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, diff --git a/public/electron.js b/public/electron.js index ae3d252..5730cf7 100644 --- a/public/electron.js +++ b/public/electron.js @@ -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') @@ -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 diff --git a/src/config/trigger.js b/src/config/trigger.js index 787e8f6..bf35dec 100644 --- a/src/config/trigger.js +++ b/src/config/trigger.js @@ -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, @@ -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 }