diff --git a/gcode.c b/gcode.c index d4f38b7..7cf1b8e 100644 --- a/gcode.c +++ b/gcode.c @@ -90,7 +90,7 @@ void gc_init() { gc.feed_rate = settings.default_feed_rate/60; gc.seek_rate = settings.default_seek_rate/60; select_plane(X_AXIS, Y_AXIS, Z_AXIS); - gc.absolute_mode = TRUE; + gc.absolute_mode = true; } float to_millimeters(double value) { @@ -122,9 +122,9 @@ uint8_t gc_execute_line(char *line) { double value; double unit_converted_value; double inverse_feed_rate = -1; // negative inverse_feed_rate means no inverse_feed_rate specified - int radius_mode = FALSE; + int radius_mode = false; - uint8_t absolute_override = FALSE; /* 1 = absolute motion for this block only {G53} */ + uint8_t absolute_override = false; /* 1 = absolute motion for this block only {G53} */ uint8_t next_action = NEXT_ACTION_DEFAULT; /* The action that will be taken by the parsed line */ double target[3], offset[3]; @@ -155,15 +155,15 @@ uint8_t gc_execute_line(char *line) { case 17: select_plane(X_AXIS, Y_AXIS, Z_AXIS); break; case 18: select_plane(X_AXIS, Z_AXIS, Y_AXIS); break; case 19: select_plane(Y_AXIS, Z_AXIS, X_AXIS); break; - case 20: gc.inches_mode = TRUE; break; - case 21: gc.inches_mode = FALSE; break; + case 20: gc.inches_mode = true; break; + case 21: gc.inches_mode = false; break; case 28: case 30: next_action = NEXT_ACTION_GO_HOME; break; - case 53: absolute_override = TRUE; break; + case 53: absolute_override = true; break; case 80: gc.motion_mode = MOTION_MODE_CANCEL; break; - case 90: gc.absolute_mode = TRUE; break; - case 91: gc.absolute_mode = FALSE; break; - case 93: gc.inverse_feed_rate_mode = TRUE; break; - case 94: gc.inverse_feed_rate_mode = FALSE; break; + case 90: gc.absolute_mode = true; break; + case 91: gc.absolute_mode = false; break; + case 93: gc.inverse_feed_rate_mode = true; break; + case 94: gc.inverse_feed_rate_mode = false; break; default: FAIL(STATUS_UNSUPPORTED_STATEMENT); } break; @@ -208,7 +208,7 @@ uint8_t gc_execute_line(char *line) { break; case 'I': case 'J': case 'K': offset[letter-'I'] = unit_converted_value; break; case 'P': p = value; break; - case 'R': r = unit_converted_value; radius_mode = TRUE; break; + case 'R': r = unit_converted_value; radius_mode = true; break; case 'S': gc.spindle_speed = value; break; case 'X': case 'Y': case 'Z': if (gc.absolute_mode || absolute_override) { @@ -238,7 +238,7 @@ uint8_t gc_execute_line(char *line) { switch (gc.motion_mode) { case MOTION_MODE_CANCEL: break; case MOTION_MODE_SEEK: - mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], gc.seek_rate, FALSE); + mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], gc.seek_rate, false); break; case MOTION_MODE_LINEAR: mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], diff --git a/motion_control.c b/motion_control.c index f1f1b45..f799cca 100644 --- a/motion_control.c +++ b/motion_control.c @@ -48,7 +48,7 @@ void mc_arc(double theta, double angular_travel, double radius, double linear_tr int axis_linear, double feed_rate, int invert_feed_rate, double *position) { int acceleration_manager_was_enabled = plan_is_acceleration_manager_enabled(); - plan_set_acceleration_manager_enabled(FALSE); // disable acceleration management for the duration of the arc + plan_set_acceleration_manager_enabled(false); // disable acceleration management for the duration of the arc double millimeters_of_travel = hypot(angular_travel*radius, labs(linear_travel)); if (millimeters_of_travel == 0.0) { return; } uint16_t segments = ceil(millimeters_of_travel/settings.mm_per_arc_segment); diff --git a/nuts_bolts.h b/nuts_bolts.h index 614cc12..7cd745d 100644 --- a/nuts_bolts.h +++ b/nuts_bolts.h @@ -23,8 +23,8 @@ #include #include -#define FALSE 0 -#define TRUE 1 +#define false 0 +#define true 1 #define X_AXIS 0 #define Y_AXIS 1 diff --git a/planner.c b/planner.c index d1109bd..ce7f184 100644 --- a/planner.c +++ b/planner.c @@ -307,7 +307,7 @@ void planner_recalculate() { void plan_init() { block_buffer_head = 0; block_buffer_tail = 0; - plan_set_acceleration_manager_enabled(TRUE); + plan_set_acceleration_manager_enabled(true); clear_vector(position); } diff --git a/settings.c b/settings.c index e5b2583..1e6f290 100644 --- a/settings.c +++ b/settings.c @@ -116,19 +116,19 @@ int read_settings() { if (version == SETTINGS_VERSION) { // Read settings-record and check checksum if (!(memcpy_from_eeprom_with_checksum((char*)&settings, 1, sizeof(settings_t)))) { - return(FALSE); + return(false); } } else if (version == 1) { // Migrate from old settings version if (!(memcpy_from_eeprom_with_checksum((char*)&settings, 1, sizeof(settings_v1_t)))) { - return(FALSE); + return(false); } settings.acceleration = DEFAULT_ACCELERATION; settings.max_jerk = DEFAULT_MAX_JERK; } else { - return(FALSE); + return(false); } - return(TRUE); + return(true); } // A helper method to set settings from command line diff --git a/stepper.c b/stepper.c index 2fcbec5..964082d 100644 --- a/stepper.c +++ b/stepper.c @@ -55,7 +55,7 @@ static int32_t counter_x, // Counter variables for the bresenham line trac counter_y, counter_z; static uint32_t step_events_completed; // The number of step events executed in the current block -static volatile int busy; // TRUE when SIG_OUTPUT_COMPARE1A is being serviced. Used to avoid retriggering that handler. +static volatile int busy; // true when SIG_OUTPUT_COMPARE1A is being serviced. Used to avoid retriggering that handler. // Variables used by the trapezoid generation static uint32_t cycles_per_step_event; // The number of machine cycles between each step event @@ -138,7 +138,7 @@ SIGNAL(TIMER1_COMPA_vect) // exactly settings.pulse_microseconds microseconds. TCNT2 = -(((settings.pulse_microseconds-2)*TICKS_PER_MICROSECOND)/8); - busy = TRUE; + busy = true; sei(); // Re enable interrupts (normally disabled while inside an interrupt handler) // ((We re-enable interrupts in order for SIG_OVERFLOW2 to be able to be triggered // at exactly the right time even if we occasionally spend a lot of time inside this handler.)) @@ -195,7 +195,7 @@ SIGNAL(TIMER1_COMPA_vect) trapezoid_generator_tick(); } - busy=FALSE; + busy=false; } // This interrupt is set up by SIG_OUTPUT_COMPARE1A when it sets the motor port bits. It resets