🎨 Misc. cleanup

x301
Scott Lahteine 3 years ago committed by Scott Lahteine
parent 8abe314b18
commit ccc66a8528

@ -41,7 +41,7 @@ extern "C" {
int udi_cdc_getc(); int udi_cdc_getc();
bool udi_cdc_is_tx_ready(); bool udi_cdc_is_tx_ready();
int udi_cdc_putc(int value); int udi_cdc_putc(int value);
}; }
// Pending character // Pending character
static int pending_char = -1; static int pending_char = -1;

@ -756,7 +756,7 @@ int8_t I2CPositionEncodersMgr::parse() {
if (!parser.has_value()) { if (!parser.has_value()) {
SERIAL_ECHOLNPGM("?A seen, but no address specified! [30-200]"); SERIAL_ECHOLNPGM("?A seen, but no address specified! [30-200]");
return I2CPE_PARSE_ERR; return I2CPE_PARSE_ERR;
}; }
I2CPE_addr = parser.value_byte(); I2CPE_addr = parser.value_byte();
if (!WITHIN(I2CPE_addr, 30, 200)) { // reserve the first 30 and last 55 if (!WITHIN(I2CPE_addr, 30, 200)) { // reserve the first 30 and last 55
@ -775,7 +775,7 @@ int8_t I2CPositionEncodersMgr::parse() {
if (!parser.has_value()) { if (!parser.has_value()) {
SERIAL_ECHOLNPGM("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1, "]"); SERIAL_ECHOLNPGM("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1, "]");
return I2CPE_PARSE_ERR; return I2CPE_PARSE_ERR;
}; }
I2CPE_idx = parser.value_byte(); I2CPE_idx = parser.value_byte();
if (I2CPE_idx >= I2CPE_ENCODER_CNT) { if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
@ -791,7 +791,7 @@ int8_t I2CPositionEncodersMgr::parse() {
I2CPE_anyaxis = parser.seen_axis(); I2CPE_anyaxis = parser.seen_axis();
return I2CPE_PARSE_OK; return I2CPE_PARSE_OK;
}; }
/** /**
* M860: Report the position(s) of position encoder module(s). * M860: Report the position(s) of position encoder module(s).
@ -934,7 +934,7 @@ void I2CPositionEncodersMgr::M864() {
if (!parser.has_value()) { if (!parser.has_value()) {
SERIAL_ECHOLNPGM("?S seen, but no address specified! [30-200]"); SERIAL_ECHOLNPGM("?S seen, but no address specified! [30-200]");
return; return;
}; }
newAddress = parser.value_byte(); newAddress = parser.value_byte();
if (!WITHIN(newAddress, 30, 200)) { if (!WITHIN(newAddress, 30, 200)) {

@ -472,12 +472,8 @@
void tmc_set_report_interval(const uint16_t update_interval) { void tmc_set_report_interval(const uint16_t update_interval) {
if ((report_tmc_status_interval = update_interval)) if ((report_tmc_status_interval = update_interval))
SERIAL_ECHOLNPGM("axis:pwm_scale" SERIAL_ECHOLNPGM("axis:pwm_scale"
#if HAS_STEALTHCHOP TERN_(HAS_STEALTHCHOP, "/curr_scale")
"/curr_scale" TERN_(HAS_STALLGUARD, "/mech_load")
#endif
#if HAS_STALLGUARD
"/mech_load"
#endif
"|flags|warncount" "|flags|warncount"
); );
} }

@ -666,7 +666,7 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)
* 1) For each nozzle, touch top and sides of object to determine object position and * 1) For each nozzle, touch top and sides of object to determine object position and
* nozzle offsets. Do a fast but rough search over a wider area. * nozzle offsets. Do a fast but rough search over a wider area.
* 2) With the first nozzle, touch top and sides of object to determine backlash values * 2) With the first nozzle, touch top and sides of object to determine backlash values
* for all axis (if BACKLASH_GCODE is enabled) * for all axes (if BACKLASH_GCODE is enabled)
* 3) For each nozzle, touch top and sides of object slowly to determine precise * 3) For each nozzle, touch top and sides of object slowly to determine precise
* position of object. Adjust coordinate system and nozzle offsets so probed object * position of object. Adjust coordinate system and nozzle offsets so probed object
* location corresponds to known object location with a high degree of precision. * location corresponds to known object location with a high degree of precision.

@ -67,13 +67,13 @@
void GcodeSuite::M600() { void GcodeSuite::M600() {
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
const int8_t target_e_stepper = get_target_e_stepper_from_command(); const int8_t eindex = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return; if (eindex < 0) return;
const uint8_t old_mixing_tool = mixer.get_current_vtool(); const uint8_t old_mixing_tool = mixer.get_current_vtool();
mixer.T(MIXER_DIRECT_SET_TOOL); mixer.T(MIXER_DIRECT_SET_TOOL);
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(target_e_stepper) ? 1.0 : 0.0); MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(eindex) ? 1.0 : 0.0);
mixer.normalize(); mixer.normalize();
const int8_t target_extruder = active_extruder; const int8_t target_extruder = active_extruder;

@ -60,13 +60,13 @@ void GcodeSuite::M701() {
if (TERN0(NO_MOTION_BEFORE_HOMING, axes_should_home())) park_point.z = 0; if (TERN0(NO_MOTION_BEFORE_HOMING, axes_should_home())) park_point.z = 0;
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
const int8_t target_e_stepper = get_target_e_stepper_from_command(); const int8_t eindex = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return; if (eindex < 0) return;
const uint8_t old_mixing_tool = mixer.get_current_vtool(); const uint8_t old_mixing_tool = mixer.get_current_vtool();
mixer.T(MIXER_DIRECT_SET_TOOL); mixer.T(MIXER_DIRECT_SET_TOOL);
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, (i == (uint8_t)target_e_stepper) ? 1.0 : 0.0); MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(eindex) ? 1.0 : 0.0);
mixer.normalize(); mixer.normalize();
const int8_t target_extruder = active_extruder; const int8_t target_extruder = active_extruder;
@ -165,10 +165,10 @@ void GcodeSuite::M702() {
#endif #endif
if (seenT) { if (seenT) {
const int8_t target_e_stepper = get_target_e_stepper_from_command(); const int8_t eindex = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return; if (eindex < 0) return;
mixer.T(MIXER_DIRECT_SET_TOOL); mixer.T(MIXER_DIRECT_SET_TOOL);
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, (i == (uint8_t)target_e_stepper) ? 1.0 : 0.0); MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(eindex) ? 1.0 : 0.0);
mixer.normalize(); mixer.normalize();
} }

@ -53,9 +53,7 @@ void GcodeSuite::M430() {
SERIAL_ECHOLNPGM( SERIAL_ECHOLNPGM(
#if ENABLED(POWER_MONITOR_CURRENT) #if ENABLED(POWER_MONITOR_CURRENT)
"Current: ", power_monitor.getAmps(), "A" "Current: ", power_monitor.getAmps(), "A"
#if ENABLED(POWER_MONITOR_VOLTAGE) TERN_(POWER_MONITOR_VOLTAGE, " ")
" "
#endif
#endif #endif
#if ENABLED(POWER_MONITOR_VOLTAGE) #if ENABLED(POWER_MONITOR_VOLTAGE)
"Voltage: ", power_monitor.getVolts(), "V" "Voltage: ", power_monitor.getVolts(), "V"

@ -430,12 +430,13 @@ bool DiskIODriver_SPI_SD::readData(uint8_t *dst) {
// uses the x^16,x^12,x^5,x^1 polynomial. // uses the x^16,x^12,x^5,x^1 polynomial.
static uint16_t CRC_CCITT(const uint8_t *data, size_t n) { static uint16_t CRC_CCITT(const uint8_t *data, size_t n) {
uint16_t crc = 0; uint16_t crc = 0;
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++)
crc = pgm_read_word(&crctab16[(crc >> 8 ^ data[i]) & 0xFF]) ^ (crc << 8); crc = pgm_read_word(&crctab16[(crc >> 8 ^ data[i]) & 0xFF]) ^ (crc << 8);
}
return crc; return crc;
} }
#else #else
// slower CRC-CCITT // slower CRC-CCITT
// uses the x^16,x^12,x^5,x^1 polynomial. // uses the x^16,x^12,x^5,x^1 polynomial.
static uint16_t CRC_CCITT(const uint8_t *data, size_t n) { static uint16_t CRC_CCITT(const uint8_t *data, size_t n) {
@ -449,7 +450,9 @@ bool DiskIODriver_SPI_SD::readData(uint8_t *dst) {
} }
return crc; return crc;
} }
#endif #endif
#endif // SD_CHECK_AND_RETRY #endif // SD_CHECK_AND_RETRY
bool DiskIODriver_SPI_SD::readData(uint8_t *dst, const uint16_t count) { bool DiskIODriver_SPI_SD::readData(uint8_t *dst, const uint16_t count) {

@ -47,7 +47,7 @@ void MAX3421e::regWr(uint8_t reg, uint8_t data) {
spiSend(reg | 0x02); spiSend(reg | 0x02);
spiSend(data); spiSend(data);
ncs(); ncs();
}; }
// multiple-byte write // multiple-byte write
// return a pointer to memory position after last written // return a pointer to memory position after last written

@ -349,18 +349,18 @@ class jsLog {
var wmGCommands = { var wmGCommands = {
CustomCmd : new wmGCommandItem('',null,null,'Custom command'), CustomCmd : new wmGCommandItem('',null,null,'Custom command'),
MoveFw : new wmGCommandItem('G1','Y{0}',10,'Move forward on Y axis'), MoveFw : new wmGCommandItem('G1','Y{0}',10,'Move Y forward'),
MoveBw : new wmGCommandItem('G1','Y-{0}',10,'Move backward on Y axis'), MoveBw : new wmGCommandItem('G1','Y-{0}',10,'Move Y backward'),
MoveSx : new wmGCommandItem('G1','X{0}',10,'Move left on X axis'), MoveSx : new wmGCommandItem('G1','X{0}',10,'Move X left'),
MoveDx : new wmGCommandItem('G1','X-{0}',10,'Move right on X axis'), MoveDx : new wmGCommandItem('G1','X-{0}',10,'Move X right'),
MoveUp : new wmGCommandItem('G1','Z{0}',10,'Move up on Z axis'), MoveUp : new wmGCommandItem('G1','Z{0}',10,'Move Z up'),
MoveDw : new wmGCommandItem('G1','Z-{0}',10,'Move down on Z axis'), MoveDw : new wmGCommandItem('G1','Z-{0}',10,'Move Z down'),
FillRetrive : new wmGCommandItem('G10',null,null,'Retract filament'), FillRetrive : new wmGCommandItem('G10',null,null,'Retract filament'),
FillExtrude : new wmGCommandItem('GYYYY',null,null,'Extrude filament'), FillExtrude : new wmGCommandItem('GYYYY',null,null,'Extrude filament'),
MoveHome : new wmGCommandItem('G28',null,null,'Go home on all axis'), MoveHome : new wmGCommandItem('G28',null,null,'Home all axes'),
MoveHomeX : new wmGCommandItem('G28','X',null,'Go home on X axis'), MoveHomeX : new wmGCommandItem('G28','X',null,'Home X axis'),
MoveHomeY : new wmGCommandItem('G28','Y',null,'Go home on Y axis'), MoveHomeY : new wmGCommandItem('G28','Y',null,'Home Y axis'),
MoveHomeZ : new wmGCommandItem('G28','Z',null,'Go home on Z axis'), MoveHomeZ : new wmGCommandItem('G28','Z',null,'Home Z axis'),
StepEnable : new wmGCommandItem('M17','{0}','E X Y Z','Enable stepper'), StepEnable : new wmGCommandItem('M17','{0}','E X Y Z','Enable stepper'),
StepEnableAll : new wmGCommandItem('M17',null,null,'Enable all steppers'), StepEnableAll : new wmGCommandItem('M17',null,null,'Enable all steppers'),
StepDisable : new wmGCommandItem('M18','{0}','E X Y Z','Disable stepper'), StepDisable : new wmGCommandItem('M18','{0}','E X Y Z','Disable stepper'),

Loading…
Cancel
Save