🎨 Misc. cleanup

This commit is contained in:
Scott Lahteine 2021-12-21 22:15:48 -06:00 committed by Scott Lahteine
parent 8abe314b18
commit ccc66a8528
13 changed files with 75 additions and 78 deletions

View File

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

View File

@ -10,7 +10,7 @@
#include "../../../sd/cardreader.h"
extern "C" {
#include "sd_mmc_spi_mem.h"
#include "sd_mmc_spi_mem.h"
}
#define SD_MMC_BLOCK_SIZE 512

View File

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

View File

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

View File

@ -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
* 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
* 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
* position of object. Adjust coordinate system and nozzle offsets so probed object
* location corresponds to known object location with a high degree of precision.

View File

@ -67,13 +67,13 @@
void GcodeSuite::M600() {
#if ENABLED(MIXING_EXTRUDER)
const int8_t target_e_stepper = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return;
const int8_t eindex = get_target_e_stepper_from_command();
if (eindex < 0) return;
const uint8_t old_mixing_tool = mixer.get_current_vtool();
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();
const int8_t target_extruder = active_extruder;

View File

@ -60,13 +60,13 @@ void GcodeSuite::M701() {
if (TERN0(NO_MOTION_BEFORE_HOMING, axes_should_home())) park_point.z = 0;
#if ENABLED(MIXING_EXTRUDER)
const int8_t target_e_stepper = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return;
const int8_t eindex = get_target_e_stepper_from_command();
if (eindex < 0) return;
const uint8_t old_mixing_tool = mixer.get_current_vtool();
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();
const int8_t target_extruder = active_extruder;
@ -165,10 +165,10 @@ void GcodeSuite::M702() {
#endif
if (seenT) {
const int8_t target_e_stepper = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return;
const int8_t eindex = get_target_e_stepper_from_command();
if (eindex < 0) return;
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();
}

View File

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

View File

@ -366,7 +366,7 @@ int8_t ChironTFT::FindToken(char c) {
#endif
return pos;
}
} while(++pos < command_len);
} while (++pos < command_len);
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPGM("Not found: ", c);
#endif

View File

@ -77,7 +77,7 @@ const char *FilesScreen::getSelectedFilename(bool shortName) {
}
void FilesScreen::drawSelectedFile() {
if(mydata.selected_tag == 0xFF) return;
if (mydata.selected_tag == 0xFF) return;
FileList files;
files.seek(getSelectedFileIndex(), true);
mydata.flags.is_dir = files.isDir();

View File

@ -430,12 +430,13 @@ bool DiskIODriver_SPI_SD::readData(uint8_t *dst) {
// uses the x^16,x^12,x^5,x^1 polynomial.
static uint16_t CRC_CCITT(const uint8_t *data, size_t n) {
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);
}
return crc;
}
#else
// slower CRC-CCITT
// uses the x^16,x^12,x^5,x^1 polynomial.
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;
}
#endif
#endif // SD_CHECK_AND_RETRY
bool DiskIODriver_SPI_SD::readData(uint8_t *dst, const uint16_t count) {

View File

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

View File

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