Skip to content

Instantly share code, notes, and snippets.

@Wurstnase
Created January 31, 2017 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wurstnase/5bc0bcbf08c7a40acded14bf30610704 to your computer and use it in GitHub Desktop.
Save Wurstnase/5bc0bcbf08c7a40acded14bf30610704 to your computer and use it in GitHub Desktop.
Test patch for uint8_t
diff --git a/dda.c b/dda.c
index 421755f..2436a81 100644
--- a/dda.c
+++ b/dda.c
@@ -156,7 +156,7 @@ void dda_create(DDA *dda, const TARGET *target) {
enum axis_e i;
#ifdef LOOKAHEAD
// Number the moves to identify them; allowed to overflow.
- static uint8_t idcnt = 0;
+ static uint_fast8_t idcnt = 0;
static DDA* prev_dda = NULL;
if (prev_dda && prev_dda->done)
@@ -733,12 +733,12 @@ void dda_step(DDA *dda) {
void dda_clock() {
DDA *dda;
static DDA *last_dda = NULL;
- uint8_t endstop_trigger = 0;
+ uint_fast8_t endstop_trigger = 0;
#ifdef ACCELERATION_RAMPING
uint32_t move_step_no, move_c;
int32_t move_n;
- uint8_t recalc_speed;
- uint8_t current_id ;
+ uint_fast8_t recalc_speed;
+ uint_fast8_t current_id ;
#endif
ATOMIC_START
diff --git a/dda.h b/dda.h
index a4bedae..af460bf 100644
--- a/dda.h
+++ b/dda.h
@@ -140,7 +140,7 @@ typedef struct {
// Number the moves to be able to test at the end of lookahead if the moves
// are the same. Note: we do not need a lot of granularity here: more than
// MOVEBUFFER_SIZE is already enough.
- uint8_t id;
+ uint_fast8_t id;
#endif
#endif
#ifdef ACCELERATION_TEMPORAL
@@ -152,11 +152,11 @@ typedef struct {
/// word boundaries only and fill smaller variables in between with gaps,
/// so keep small variables grouped together to reduce the amount of these
/// gaps. See e.g. NXP application note AN10963, page 10f.
- uint8_t fast_axis; ///< number of the fast axis
+ uint_fast8_t fast_axis; ///< number of the fast axis
/// Endstop homing
- uint8_t endstop_check; ///< Do we need to check endstops? 0x1=Check X, 0x2=Check Y, 0x4=Check Z
- uint8_t endstop_stop_cond; ///< Endstop condition on which to stop motion: 0=Stop on detrigger, 1=Stop on trigger
+ uint_fast8_t endstop_check; ///< Do we need to check endstops? 0x1=Check X, 0x2=Check Y, 0x4=Check Z
+ uint_fast8_t endstop_stop_cond; ///< Endstop condition on which to stop motion: 0=Stop on detrigger, 1=Stop on trigger
} DDA;
/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment