Skip to content

Commit

Permalink
dropped extended pins imediate update
Browse files Browse the repository at this point in the history
- dropped extended pins imediate update in io control core api to prevent performance issues.
- generic pins must be considered non critical/time critical
  • Loading branch information
Paciente8159 committed Feb 20, 2025
1 parent 2b1e414 commit 75d2ea0
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions uCNC/src/core/io_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,18 +1762,38 @@ void io_set_pinvalue(uint8_t pin, uint8_t value)
#endif
}
}

// this ensures the pin is updated after writing (but might lead to slow or sucessive multiple readings and make firmware slow)
// extended pins (when not updated by an ISR), are updated frequently in the main loop
// for this reason will be assumed that extended pins might not update instantly.
// updating handling must be treated as a per need case like done in softuart/softspi modules

// #if (IC74HC595_COUNT > 0)
// #if defined(IC74HC165_HAS_PWM) || defined(IC74HC165_HAS_SERVOS) || defined(IC74HC165_HAS_DOUTS)
// if (pin >= PWM_PINS_OFFSET && pin < 100)
// {
// shift_register_io_pins();
// }
// #endif
// #endif
}

int16_t io_get_pinvalue(uint8_t pin)
{
#if (IC74HC165_COUNT > 0)
#if defined(IC74HC165_HAS_LIMITS) || defined(IC74HC165_HAS_CONTROLS) || defined(IC74HC165_HAS_PROBE)
if (pin >= 100 && pin < ANALOG_PINS_OFFSET)
{
shift_register_io_pins();
}
#endif
#endif

// this ensures the pin is updated before reading (but might lead to slow or sucessive multiple readings and make firmware slow)
// extended pins (when not updated by an ISR), are updated frequently in the main loop
// for this reason will be assumed that extended pins might not update instantly
// updating handling must be treated as a per need case like done in softuart/softspi modules

// #if (IC74HC165_COUNT > 0)
// #if defined(IC74HC165_HAS_LIMITS) || defined(IC74HC165_HAS_CONTROLS) || defined(IC74HC165_HAS_PROBE)
// if (pin >= 100 && pin < ANALOG_PINS_OFFSET)
// {
// shift_register_io_pins();
// }
// #endif
// #endif

switch (pin)
{
Expand Down

0 comments on commit 75d2ea0

Please sign in to comment.