fix(hal): implement onLeaveConnected for ID003 validator initialization
The ID003 FSM was stuck in the PowerUp state because leaving the Connected state never emitted 'ready'. This is the trigger for the denomination/reset initialization chain. Added onLeaveState() method that emits 'ready' when leaving Connected, matching the original lamassu-machine behavior (onleaveConnected). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
94a9f03e2e
commit
bb73e13e48
1 changed files with 7 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ export class Id003Fsm extends EventEmitter {
|
|||
const from = this._state
|
||||
this.clearStateTimeout()
|
||||
console.log('FSM: %s [ %s -> %s ]', event ?? 'transition', from, to)
|
||||
this.onLeaveState(from)
|
||||
this._state = to
|
||||
this.onEnterState(to, from, data)
|
||||
}
|
||||
|
|
@ -75,13 +76,18 @@ export class Id003Fsm extends EventEmitter {
|
|||
}, TRANSIENT_TIMEOUT)
|
||||
}
|
||||
|
||||
private onLeaveState(state: string): void {
|
||||
if (state === 'Connected') {
|
||||
this.emit('ready')
|
||||
}
|
||||
}
|
||||
|
||||
private onEnterState(state: string, from: string, data?: unknown): void {
|
||||
switch (state) {
|
||||
case 'PowerUp':
|
||||
this.emit('powerUp')
|
||||
break
|
||||
case 'Connected':
|
||||
// Will emit 'ready' on leave
|
||||
break
|
||||
case 'Denominations':
|
||||
this.emit('denominations')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue