feat: i1Pro 2 visual LED feedback in chartread (#37) #47

Merged
gronod merged 1 commits from feat/i1pro2-led-feedback into development 2026-09-05 18:16:44 +01:00
Owner

Overview

Implements real-time visual status feedback via the integrated ring LEDs on the X-Rite i1Pro 2 (Rev E) spectrophotometer during chartread sessions (fixes #37).

Key Additions

  • spectro/inst.h & spectro/inst.c:
    • Defined inst_led_state enumeration (inst_led_off, inst_led_cal_wait, inst_led_row_ready, inst_led_row_fail, inst_led_row_success).
    • Added #define INST_CAP_LED_STATUS inst2_has_leds capability flag.
    • Added set_led_state method pointer to INST_OBJ_BASE with inst_unsupported default fallback.
  • spectro/i1pro_imp.c & spectro/i1pro_imp.h:
    • Added thread management state (led_th, led_th_run, led_lock, current_led_state) to struct _i1proimp.
    • Implemented i1pro2_indLEDset() to send color mask sequences via USB endpoint 0x03 with vendor request 0xD6.
    • Implemented i1pro2_led_thread() asynchronous worker thread for pulse timing (White 500ms/500ms, Blue 300ms/700ms, Red 3x 100ms/100ms, Green 400ms solid, Off).
    • Added responsive sub-20ms state polling and clean thread join / LED extinguishing in i1pro_stop_threads() for safe teardown.
  • spectro/i1pro.c:
    • Exposed inst2_has_leds capability and wired p->set_led_state = i1pro_set_led_state; when dtype == instI1Pro2.
  • spectro/chartread.c:
    • Added -Y l / -Y L command-line switch preserving backwards compatibility with existing -L (dolab = 2).
    • Integrated status feedback hooks at calibration prompt/completion, row scan readiness, misread error, read success acceptance, and session abort/exit.

Verification

  • Built full codebase with Jam.
  • Verified ./bin/chartread -\?, -Y l, and backwards compatibility with -L.
### Overview Implements real-time visual status feedback via the integrated ring LEDs on the X-Rite i1Pro 2 (Rev E) spectrophotometer during `chartread` sessions (fixes #37). ### Key Additions - **`spectro/inst.h` & `spectro/inst.c`:** - Defined `inst_led_state` enumeration (`inst_led_off`, `inst_led_cal_wait`, `inst_led_row_ready`, `inst_led_row_fail`, `inst_led_row_success`). - Added `#define INST_CAP_LED_STATUS inst2_has_leds` capability flag. - Added `set_led_state` method pointer to `INST_OBJ_BASE` with `inst_unsupported` default fallback. - **`spectro/i1pro_imp.c` & `spectro/i1pro_imp.h`:** - Added thread management state (`led_th`, `led_th_run`, `led_lock`, `current_led_state`) to `struct _i1proimp`. - Implemented `i1pro2_indLEDset()` to send color mask sequences via USB endpoint 0x03 with vendor request 0xD6. - Implemented `i1pro2_led_thread()` asynchronous worker thread for pulse timing (White 500ms/500ms, Blue 300ms/700ms, Red 3x 100ms/100ms, Green 400ms solid, Off). - Added responsive sub-20ms state polling and clean thread join / LED extinguishing in `i1pro_stop_threads()` for safe teardown. - **`spectro/i1pro.c`:** - Exposed `inst2_has_leds` capability and wired `p->set_led_state = i1pro_set_led_state;` when `dtype == instI1Pro2`. - **`spectro/chartread.c`:** - Added `-Y l` / `-Y L` command-line switch preserving backwards compatibility with existing `-L` (`dolab = 2`). - Integrated status feedback hooks at calibration prompt/completion, row scan readiness, misread error, read success acceptance, and session abort/exit. ### Verification - Built full codebase with Jam. - Verified `./bin/chartread -\?`, `-Y l`, and backwards compatibility with `-L`.
gronod added 1 commit 2026-09-05 18:16:38 +01:00
- Add inst_led_state enum, INST_CAP_LED_STATUS capability, and set_led_state to inst.h / inst.c
- Implement i1pro2_indLEDset, worker thread i1pro2_led_thread, and i1pro_imp_set_led_state in i1pro_imp.c / i1pro_imp.h
- Wire up i1pro_set_led_state and determine_capabilities in i1pro.c for i1Pro 2 (Rev E)
- Integrate -Y l option and lifecycle hooks in chartread.c for calibration, readiness, success, failure, and clean exit
gronod merged commit ca85951565 into development 2026-09-05 18:16:44 +01:00
Sign in to join this conversation.