fix(machine): enable/disable validator on state transitions (direct HAL)
The IPC path already had a watcher to enable the bill validator when entering insertingBills and disable it when leaving. The direct HAL path (initializeWithHal) was missing this, meaning the validator would accept bills in any state. Matches brain.js pattern (lines 193-196). Closes #28 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ab2ea0b811
commit
5182b3634e
1 changed files with 12 additions and 0 deletions
|
|
@ -665,6 +665,18 @@ export const useAtmStore = defineStore('atm', () => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Watch state transitions to enable/disable validator hardware
|
||||||
|
watch(nestedState, (newState, oldState) => {
|
||||||
|
if (newState === 'insertingBills' && oldState !== 'insertingBills') {
|
||||||
|
console.log('[ATM] Enabling bill validator')
|
||||||
|
hal.enableValidator()
|
||||||
|
}
|
||||||
|
if (oldState === 'insertingBills' && newState !== 'insertingBills') {
|
||||||
|
console.log('[ATM] Disabling bill validator')
|
||||||
|
hal.disableValidator()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
console.log('[ATM] Fully initialized with HAL + Lightning')
|
console.log('[ATM] Fully initialized with HAL + Lightning')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[ATM] HAL initialization failed:', error)
|
console.error('[ATM] HAL initialization failed:', error)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue