Commit 14af5afb authored by MagoKimbra's avatar MagoKimbra

Update v4_2_6

parent d5cef6c9
...@@ -561,8 +561,7 @@ ...@@ -561,8 +561,7 @@
//#define ADVANCE //#define ADVANCE
#define EXTRUDER_ADVANCE_K .0 #define EXTRUDER_ADVANCE_K .0
#define D_FILAMENT 2.85 #define D_FILAMENT 1.75
#define STEPS_MM_E 836
/*****************************************************************************************/ /*****************************************************************************************/
......
...@@ -816,27 +816,27 @@ ...@@ -816,27 +816,27 @@
****************************************************************************************/ ****************************************************************************************/
#if MB(RAMPS_13_HFB) #if MB(RAMPS_13_HFB)
#define KNOWN_BOARD 1 #define KNOWN_BOARD 1
#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif #endif
#define LARGE_FLASH true #define LARGE_FLASH true
// X axis pins // X axis pins
#define ORIG_X_STEP_PIN 54 #define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55 #define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38 #define ORIG_X_ENABLE_PIN 38
#define ORIG_X_MIN_PIN 3 #define ORIG_X_MIN_PIN 3
#define ORIG_X_MAX_PIN 2 #define ORIG_X_MAX_PIN 2
// Y axis pins // Y axis pins
#define ORIG_Y_STEP_PIN 60 #define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61 #define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56 #define ORIG_Y_ENABLE_PIN 56
#define ORIG_Y_MIN_PIN 14 #define ORIG_Y_MIN_PIN 14
#define ORIG_Y_MAX_PIN 15 #define ORIG_Y_MAX_PIN 15
#define Y2_STEP_PIN 36 #define Y2_STEP_PIN 36
#define Y2_DIR_PIN 34 #define Y2_DIR_PIN 34
#define Y2_ENABLE_PIN 30 #define Y2_ENABLE_PIN 30
...@@ -860,14 +860,14 @@ ...@@ -860,14 +860,14 @@
#define ORIG_E1_STEP_PIN 36 #define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34 #define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30 #define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1 #define SDPOWER -1
#define SDSS 53 #define SDSS 53
#define LED_PIN 13 #define LED_PIN 13
#define ORIG_FAN_PIN 9 #define ORIG_FAN_PIN 9
#define ORIG_PS_ON_PIN 12 #define ORIG_PS_ON_PIN 12
#define ORIG_HEATER_0_PIN 10 // Hotend 1 #define ORIG_HEATER_0_PIN 10 // Hotend 1
#define ORIG_HEATER_1_PIN -1 #define ORIG_HEATER_1_PIN -1
#define ORIG_HEATER_2_PIN -1 #define ORIG_HEATER_2_PIN -1
...@@ -877,7 +877,7 @@ ...@@ -877,7 +877,7 @@
#define ORIG_TEMP_1_PIN 15 // ANALOG NUMBERING #define ORIG_TEMP_1_PIN 15 // ANALOG NUMBERING
#define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING #define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING
#define ORIG_TEMP_3_PIN -1 // ANALOG NUMBERING #define ORIG_TEMP_3_PIN -1 // ANALOG NUMBERING
#define ORIG_HEATER_BED_PIN 8 // BED #define ORIG_HEATER_BED_PIN 8 // BED
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING #define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
...@@ -917,7 +917,7 @@ ...@@ -917,7 +917,7 @@
#define LCD_PINS_D6 27 #define LCD_PINS_D6 27
#define LCD_PINS_D7 29 #define LCD_PINS_D7 29
#endif // PANEL_ONE #endif // PANEL_ONE
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
#define ORIG_BEEPER_PIN 37 #define ORIG_BEEPER_PIN 37
...@@ -971,7 +971,7 @@ ...@@ -971,7 +971,7 @@
#define BTN_EN2 35 #define BTN_EN2 35
#define BTN_ENC 31 // the click #define BTN_ENC 31 // the click
#endif #endif
#if ENABLED(G3D_PANEL) #if ENABLED(G3D_PANEL)
#define SD_DETECT_PIN 49 #define SD_DETECT_PIN 49
#else #else
...@@ -979,7 +979,7 @@ ...@@ -979,7 +979,7 @@
#endif #endif
#endif #endif
#else // old style panel with shift register #else // old style panel with shift register
// arduino pin witch triggers an piezo beeper // arduino pin witch triggers an piezo beeper
#define ORIG_BEEPER_PIN 33 // No Beeper added #define ORIG_BEEPER_PIN 33 // No Beeper added
...@@ -990,7 +990,7 @@ ...@@ -990,7 +990,7 @@
//#define SHIFT_LD 42 //#define SHIFT_LD 42
//#define SHIFT_OUT 40 //#define SHIFT_OUT 40
//#define SHIFT_EN 17 //#define SHIFT_EN 17
#define LCD_PINS_RS 16 #define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17 #define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23 #define LCD_PINS_D4 23
......
This diff is collapsed.
...@@ -89,7 +89,7 @@ void refresh_cmd_timeout(); ...@@ -89,7 +89,7 @@ void refresh_cmd_timeout();
extern void delay_ms(millis_t ms); extern void delay_ms(millis_t ms);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
void setPwmFrequency(uint8_t pin, int val); void setPwmFrequency(uint8_t pin, uint8_t val);
#endif #endif
extern float homing_feedrate[]; extern float homing_feedrate[];
...@@ -120,7 +120,7 @@ extern uint8_t axis_was_homed; ...@@ -120,7 +120,7 @@ extern uint8_t axis_was_homed;
#endif #endif
#if ENABLED(NPR2) #if ENABLED(NPR2)
extern int old_color; // old color for system NPR2 extern uint8_t old_color; // old color for system NPR2
#endif #endif
#if MECH(DELTA) #if MECH(DELTA)
......
...@@ -234,6 +234,7 @@ ...@@ -234,6 +234,7 @@
*/ */
#if ENABLED(DONDOLO) #if ENABLED(DONDOLO)
#undef SINGLENOZZLE #undef SINGLENOZZLE
#undef ADVANCE
#undef DRIVER_EXTRUDERS #undef DRIVER_EXTRUDERS
#define DRIVER_EXTRUDERS 1 #define DRIVER_EXTRUDERS 1
#endif #endif
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
#define SERIAL_ACTIVE_COLOR "Active Color: " #define SERIAL_ACTIVE_COLOR "Active Color: "
#define MSG_COUNT_X " Count X:" #define MSG_COUNT_X " Count X:"
#define MSG_COUNT_A " Count A:" #define MSG_COUNT_A " Count A:"
#define MSG_COUNT_ALPHA " Count Alpha: " #define MSG_COUNT_ALPHA " Count Alpha:"
#define SERIAL_X_MIN "x_min: " #define SERIAL_X_MIN "x_min: "
#define SERIAL_X_MAX "x_max: " #define SERIAL_X_MAX "x_max: "
#define SERIAL_Y_MIN "y_min: " #define SERIAL_Y_MIN "y_min: "
......
...@@ -2084,7 +2084,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } ...@@ -2084,7 +2084,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
WRITE(SHIFT_LD, HIGH); WRITE(SHIFT_LD, HIGH);
for (int8_t i = 0; i < 8; i++) { for (int8_t i = 0; i < 8; i++) {
newbutton_reprapworld_keypad >>= 1; newbutton_reprapworld_keypad >>= 1;
if (READ(SHIFT_OUT)) newbutton_reprapworld_keypad |= BIT(7); if (READ(SHIFT_OUT)) BITSET(newbutton_reprapworld_keypad, 7);
WRITE(SHIFT_CLK, HIGH); WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW); WRITE(SHIFT_CLK, LOW);
} }
...@@ -2097,7 +2097,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } ...@@ -2097,7 +2097,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
unsigned char tmp_buttons = 0; unsigned char tmp_buttons = 0;
for (int8_t i = 0; i < 8; i++) { for (int8_t i = 0; i < 8; i++) {
newbutton >>= 1; newbutton >>= 1;
if (READ(SHIFT_OUT)) newbutton |= BIT(7); if (READ(SHIFT_OUT)) BITSET(newbutton, 7);
WRITE(SHIFT_CLK, HIGH); WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW); WRITE(SHIFT_CLK, LOW);
} }
......
...@@ -120,7 +120,8 @@ ...@@ -120,7 +120,8 @@
#define EN_B BIT(BLEN_B) #define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A) #define EN_A BIT(BLEN_A)
#define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST)) #define LCD_CLICKED (buttons&(B_MI|B_ST))
#endif//NEWPANEL #endif//NEWPANEL
char* itostr2(const uint8_t& x); char* itostr2(const uint8_t& x);
......
...@@ -205,12 +205,11 @@ FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity ...@@ -205,12 +205,11 @@ FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity
// "Junction jerk" in this context is the immediate change in speed at the junction of two blocks. // "Junction jerk" in this context is the immediate change in speed at the junction of two blocks.
// This method will calculate the junction jerk as the euclidean distance between the nominal // This method will calculate the junction jerk as the euclidean distance between the nominal
// velocities of the respective blocks. // velocities of the respective blocks.
//inline float junction_jerk(block_t *before, block_t *after) { // inline float junction_jerk(block_t *before, block_t *after) {
// return sqrt( // return sqrt(
// pow((before->speed_x-after->speed_x), 2)+pow((before->speed_y-after->speed_y), 2)); // pow((before->speed_x-after->speed_x), 2)+pow((before->speed_y-after->speed_y), 2));
//} //}
// The kernel called by planner_recalculate() when scanning the plan from last to first entry. // The kernel called by planner_recalculate() when scanning the plan from last to first entry.
void planner_reverse_pass_kernel(block_t* previous, block_t* current, block_t* next) { void planner_reverse_pass_kernel(block_t* previous, block_t* current, block_t* next) {
if (!current) return; if (!current) return;
...@@ -359,7 +358,6 @@ void plan_init() { ...@@ -359,7 +358,6 @@ void plan_init() {
previous_nominal_speed = 0.0; previous_nominal_speed = 0.0;
} }
#if ENABLED(AUTOTEMP) #if ENABLED(AUTOTEMP)
void getHighESpeed() { void getHighESpeed() {
static float oldt = 0; static float oldt = 0;
...@@ -479,7 +477,6 @@ void check_axes_activity() { ...@@ -479,7 +477,6 @@ void check_axes_activity() {
#endif #endif
} }
float junction_deviation = 0.1; float junction_deviation = 0.1;
// Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in // Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration // mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
...@@ -606,7 +603,7 @@ float junction_deviation = 0.1; ...@@ -606,7 +603,7 @@ float junction_deviation = 0.1;
// For a mixing extruder, get steps for each // For a mixing extruder, get steps for each
#if ENABLED(COLOR_MIXING_EXTRUDER) #if ENABLED(COLOR_MIXING_EXTRUDER)
for (int8_t i = 0; i < DRIVER_EXTRUDERS; i++) for (uint8_t i = 0; i < DRIVER_EXTRUDERS; i++)
block->mix_steps[i] = block->steps[E_AXIS] * mixing_factor[i]; block->mix_steps[i] = block->steps[E_AXIS] * mixing_factor[i];
#endif #endif
...@@ -618,23 +615,23 @@ float junction_deviation = 0.1; ...@@ -618,23 +615,23 @@ float junction_deviation = 0.1;
// Compute direction bits for this block // Compute direction bits for this block
uint8_t dirb = 0; uint8_t dirb = 0;
#if MECH(COREXY) #if MECH(COREXY)
if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) BITSET(dirb, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) dirb |= BIT(Y_HEAD); // ...and Y if (dy < 0) BITSET(dirb, Y_HEAD); // ...and Y
if (dz < 0) dirb |= BIT(Z_AXIS); if (dz < 0) BITSET(dirb, Z_AXIS);
if (da < 0) dirb |= BIT(A_AXIS); // Motor A direction if (da < 0) BITSET(dirb, A_AXIS); // Motor A direction
if (db < 0) dirb |= BIT(B_AXIS); // Motor B direction if (db < 0) BITSET(dirb, B_AXIS); // Motor B direction
#elif MECH(COREXZ) #elif MECH(COREXZ)
if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) BITSET(dirb, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) dirb |= BIT(Y_AXIS); if (dy < 0) BITSET(dirb, Y_AXIS);
if (dz < 0) dirb |= BIT(Z_HEAD); // ...and Z if (dz < 0) BITSET(dirb, Z_HEAD); // ...and Z
if (da < 0) dirb |= BIT(A_AXIS); // Motor A direction if (da < 0) BITSET(dirb, A_AXIS); // Motor A direction
if (dc < 0) dirb |= BIT(C_AXIS); // Motor B direction if (dc < 0) BITSET(dirb, C_AXIS); // Motor B direction
#else #else
if (dx < 0) dirb |= BIT(X_AXIS); if (dx < 0) BITSET(dirb, X_AXIS);
if (dy < 0) dirb |= BIT(Y_AXIS); if (dy < 0) BITSET(dirb, Y_AXIS);
if (dz < 0) dirb |= BIT(Z_AXIS); if (dz < 0) BITSET(dirb, Z_AXIS);
#endif #endif
if (de < 0) dirb |= BIT(E_AXIS); if (de < 0) BITSET(dirb, E_AXIS);
block->direction_bits = dirb; block->direction_bits = dirb;
block->active_driver = driver; block->active_driver = driver;
...@@ -875,14 +872,14 @@ float junction_deviation = 0.1; ...@@ -875,14 +872,14 @@ float junction_deviation = 0.1;
ys1 = axis_segment_time[Y_AXIS][1], ys1 = axis_segment_time[Y_AXIS][1],
ys2 = axis_segment_time[Y_AXIS][2]; ys2 = axis_segment_time[Y_AXIS][2];
if ((direction_change & BIT(X_AXIS)) != 0) { if (TEST(direction_change, X_AXIS)) {
xs2 = axis_segment_time[X_AXIS][2] = xs1; xs2 = axis_segment_time[X_AXIS][2] = xs1;
xs1 = axis_segment_time[X_AXIS][1] = xs0; xs1 = axis_segment_time[X_AXIS][1] = xs0;
xs0 = 0; xs0 = 0;
} }
xs0 = axis_segment_time[X_AXIS][0] = xs0 + segment_time; xs0 = axis_segment_time[X_AXIS][0] = xs0 + segment_time;
if ((direction_change & BIT(Y_AXIS)) != 0) { if (TEST(direction_change, Y_AXIS)) {
ys2 = axis_segment_time[Y_AXIS][2] = axis_segment_time[Y_AXIS][1]; ys2 = axis_segment_time[Y_AXIS][2] = axis_segment_time[Y_AXIS][1];
ys1 = axis_segment_time[Y_AXIS][1] = axis_segment_time[Y_AXIS][0]; ys1 = axis_segment_time[Y_AXIS][1] = axis_segment_time[Y_AXIS][0];
ys0 = 0; ys0 = 0;
...@@ -1058,7 +1055,7 @@ float junction_deviation = 0.1; ...@@ -1058,7 +1055,7 @@ float junction_deviation = 0.1;
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
vector_3 plan_get_position() { vector_3 plan_get_position() {
vector_3 position = vector_3(st_get_position_mm(X_AXIS), st_get_position_mm(Y_AXIS), st_get_position_mm(Z_AXIS)); vector_3 position = vector_3(st_get_axis_position_mm(X_AXIS), st_get_axis_position_mm(Y_AXIS), st_get_axis_position_mm(Z_AXIS));
//position.debug("in plan_get position"); //position.debug("in plan_get position");
//plan_bed_level_matrix.debug("in plan_get_position"); //plan_bed_level_matrix.debug("in plan_get_position");
...@@ -1076,21 +1073,21 @@ float junction_deviation = 0.1; ...@@ -1076,21 +1073,21 @@ float junction_deviation = 0.1;
#else #else
void plan_set_position(const float& x, const float& y, const float& z, const float& e) void plan_set_position(const float& x, const float& y, const float& z, const float& e)
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE
{ {
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
apply_rotation_xyz(plan_bed_level_matrix, x, y, z); apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif #endif
long nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]), long nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]),
ny = position[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]), ny = position[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]),
nz = position[Z_AXIS] = lround(z * axis_steps_per_unit[Z_AXIS]), nz = position[Z_AXIS] = lround(z * axis_steps_per_unit[Z_AXIS]),
ne = position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]); ne = position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]);
last_extruder = active_extruder; last_extruder = active_extruder;
st_set_position(nx, ny, nz, ne); st_set_position(nx, ny, nz, ne);
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest. previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = 0.0; for (uint8_t i = 0; i < NUM_AXIS; i++) previous_speed[i] = 0.0;
} }
void plan_set_e_position(const float& e) { void plan_set_e_position(const float& e) {
position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]); position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]);
...@@ -1100,6 +1097,6 @@ void plan_set_e_position(const float& e) { ...@@ -1100,6 +1097,6 @@ void plan_set_e_position(const float& e) {
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates() { void reset_acceleration_rates() {
for (int i = 0; i < 3 + EXTRUDERS; i++) for (uint8_t i = 0; i < 3 + EXTRUDERS; i++)
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i]; axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
} }
This diff is collapsed.
...@@ -117,12 +117,12 @@ void st_set_e_position(const long &e); ...@@ -117,12 +117,12 @@ void st_set_e_position(const long &e);
long st_get_position(uint8_t axis); long st_get_position(uint8_t axis);
// Get current position in mm // Get current position in mm
float st_get_position_mm(AxisEnum axis); float st_get_axis_position_mm(AxisEnum axis);
// The stepper subsystem goes to sleep when it runs out of things to execute. Call this // The stepper subsystem goes to sleep when it runs out of things to execute. Call this
// to notify the subsystem that it is time to go to work. // to notify the subsystem that it is time to go to work.
void st_wake_up(); void st_wake_up();
void checkHitEndstops(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered void checkHitEndstops(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered
void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homing and before a routine call of checkHitEndstops(); void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homing and before a routine call of checkHitEndstops();
......
...@@ -1006,9 +1006,9 @@ void tp_init() { ...@@ -1006,9 +1006,9 @@ void tp_init() {
#endif // HEATER_0_USES_MAX6675 #endif // HEATER_0_USES_MAX6675
#ifdef DIDR2 #ifdef DIDR2
#define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0) #define ANALOG_SELECT(pin) do{ if (pin < 8) BITSET(DIDR0, pin); else BITSET(DIDR2, pin - 8); }while(0)
#else #else
#define ANALOG_SELECT(pin) do{ DIDR0 |= BIT(pin); }while(0) #define ANALOG_SELECT(pin) do{ BITSET(DIDR0, pin); }while(0)
#endif #endif
// Set analog inputs // Set analog inputs
...@@ -1084,10 +1084,10 @@ void tp_init() { ...@@ -1084,10 +1084,10 @@ void tp_init() {
// Use timer0 for temperature measurement // Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt // Interleave temperature interrupt with millies interrupt
OCR0B = 128; OCR0B = 128;
TIMSK0 |= BIT(OCIE0B); BITSET(TIMSK0, OCIE0B);
// Wait for temperature measurement to settle // Wait for temperature measurement to settle
delay_ms(250); delay(250);
#define TEMP_MIN_ROUTINE(NR) \ #define TEMP_MIN_ROUTINE(NR) \
minttemp[NR] = HEATER_ ## NR ## _MINTEMP; \ minttemp[NR] = HEATER_ ## NR ## _MINTEMP; \
...@@ -1279,9 +1279,9 @@ void disable_all_heaters() { ...@@ -1279,9 +1279,9 @@ void disable_all_heaters() {
max6675_temp = 0; max6675_temp = 0;
#ifdef PRR #ifdef PRR
PRR &= ~BIT(PRSPI); BITCLR(PRR, PRSPI);
#elif defined(PRR0) #elif defined(PRR0)
PRR0 &= ~BIT(PRSPI); BITCLR(PRR0, PRSPI);
#endif #endif
SPCR = BIT(MSTR) | BIT(SPE) | BIT(SPR0); SPCR = BIT(MSTR) | BIT(SPE) | BIT(SPR0);
...@@ -1295,13 +1295,13 @@ void disable_all_heaters() { ...@@ -1295,13 +1295,13 @@ void disable_all_heaters() {
// read MSB // read MSB
SPDR = 0; SPDR = 0;
for (; (SPSR & BIT(SPIF)) == 0;); for (; !TEST(SPSR, SPIF););
max6675_temp = SPDR; max6675_temp = SPDR;
max6675_temp <<= 8; max6675_temp <<= 8;
// read LSB // read LSB
SPDR = 0; SPDR = 0;
for (; (SPSR & BIT(SPIF)) == 0;); for (; !TEST(SPSR, SPIF););
max6675_temp |= SPDR; max6675_temp |= SPDR;
// disable TT_MAX6675 // disable TT_MAX6675
...@@ -1649,7 +1649,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1649,7 +1649,7 @@ ISR(TIMER0_COMPB_vect) {
#endif // SLOW_PWM_HEATERS #endif // SLOW_PWM_HEATERS
#define SET_ADMUX_ADCSRA(pin) ADMUX = BIT(REFS0) | (pin & 0x07); ADCSRA |= BIT(ADSC) #define SET_ADMUX_ADCSRA(pin) ADMUX = BIT(REFS0) | (pin & 0x07); BITSET(ADCSRA, ADSC)
#ifdef MUX5 #ifdef MUX5
#define START_ADC(pin) if (pin > 7) ADCSRB = BIT(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin) #define START_ADC(pin) if (pin > 7) ADCSRB = BIT(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment