Skip to content

Conversation

@SukuWc
Copy link
Member

@SukuWc SukuWc commented Feb 1, 2026

  • Add GRID_MUX_UNUSED macro to grid_ain.h for cross-platform use
  • Rename mux_position to element_index for clarity
  • Add bounds asserts before array access
  • Add if-guards for unused mux indices where needed
  • Replace magic numbers with defines
  • Fix EF44 invalid lookup entries (10,8,11,9 -> unused)

Modules updated: EF44, PBF4, TEK1, TEK2

- Add GRID_MUX_UNUSED macro to grid_ain.h for cross-platform use
- Rename mux_position to element_index for clarity
- Add bounds asserts before array access
- Add if-guards for unused mux indices where needed
- Replace magic numbers with defines
- Fix EF44 invalid lookup entries (10,8,11,9 -> unused)

Modules updated: EF44, PBF4, TEK1, TEK2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SukuWc and others added 9 commits February 1, 2026 15:03
- Replace mux_overflow count with mux_positions_bm bitmask to support
  non-contiguous mux positions (e.g., PBF4 skips positions 4-5)
- Add GRID_MUX_FIRST_VALID and GRID_MUX_INCREMENT macros for shared
  mux index manipulation between ESP32 and ULP
- ULP now skips invalid mux positions, improving efficiency on Rev H
- Update all module init calls to use binary bitmask notation
- PBF4/TEK2: replace if-guard with assert since invalid positions
  are now skipped at driver level

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add GRID_AIN_INTERNAL_RESOLUTION, GRID_ADC_MAX, GRID_ADC_INVERT macros
- Add GRID_POTMETER_DEADZONE, GRID_POTMETER_CENTER platform constants
- Move GRID_MUX_* macros from grid_esp32_pins.h to grid_ain.h (shared)
- Refactor D51 BU16/PO16/PBF4 to use for loop and interleaved lookup tables
- Normalize D51 BU16 to 12-bit internal resolution (was 16-bit)
- Add invert_result_lookup tables for consistent polarity handling
- Add grid_common dependency to grid_esp32_adc for ULP build

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… data flow

- Add GRID_ADC_DOWNSAMPLE and GRID_ADC_INVERT_COND macros to grid_ain.h
- Convert all D51 modules to use 2D mux_element_lookup[channel][mux_position]
- Use element_invert_bm bitmask for constant-time conditional inversion
- Standardize callback data flow: raw -> inverted -> downsampled
- Move adcs array to global scope with correct MUX->ADC mapping
- Rename loop iterator to 'channel' for clarity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…flow

- Convert to 2D mux_element_lookup[channel][mux_state]
- Use element_invert_bm bitmask with GRID_ADC_INVERT_COND macro
- Standardize signal flow: raw -> inverted -> downsampled -> ASC -> store
- Use GRID_AIN_INTERNAL_RESOLUTION instead of hardcoded 12

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…stent signal flow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ent index

- Add ASC pass-through (factor=1) to D51 module drivers for cross-platform consistency
- Refactor grid_asc_process signature to take array and index separately
- Change ASC indexing from ADC position to element_index across all modules
- Adjust array sizes to match element counts (PBF4: 12, EF44: 8)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change first param from grid_ui_element* to grid_ui_model*
- Add element_index param to derive element internally
- Add assertions for ui pointer and bounds checking
- Rename input_channel to element_index for clarity
- Update all call sites across D51 and ESP32 modules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants