Apply const, spacing, etc.

This commit is contained in:
Scott Lahteine 2017-06-27 02:36:19 -05:00
parent c2c8aafda2
commit 941943c167
6 changed files with 43 additions and 42 deletions

View file

@ -189,7 +189,6 @@ void free_memory_pool_report(char * const ptr, const int16_t size) {
* This is useful to check the correctness of the M100 D and the M100 F commands. * This is useful to check the correctness of the M100 D and the M100 F commands.
*/ */
void corrupt_free_memory(char *ptr, const uint16_t size) { void corrupt_free_memory(char *ptr, const uint16_t size) {
if (parser.seen('C')) {
ptr += 8; ptr += 8;
const uint16_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack. const uint16_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack.
j = near_top / (size + 1); j = near_top / (size + 1);
@ -202,7 +201,6 @@ void free_memory_pool_report(char * const ptr, const int16_t size) {
} }
SERIAL_EOL(); SERIAL_EOL();
} }
}
#endif // M100_FREE_MEMORY_CORRUPTOR #endif // M100_FREE_MEMORY_CORRUPTOR
/** /**

View file

@ -1276,16 +1276,17 @@ void get_available_commands() {
* *
* Returns TRUE if the target is invalid * Returns TRUE if the target is invalid
*/ */
bool get_target_extruder_from_command(int code) { bool get_target_extruder_from_command(const uint16_t code) {
if (parser.seen('T')) { if (parser.seen('T')) {
if (parser.value_byte() >= EXTRUDERS) { const int8_t e = parser.value_byte();
if (e >= EXTRUDERS) {
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_CHAR('M');
SERIAL_ECHO(code); SERIAL_ECHO(code);
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", parser.value_byte()); SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", e);
return true; return true;
} }
target_extruder = parser.value_byte(); target_extruder = e;
} }
else else
target_extruder = active_extruder; target_extruder = active_extruder;
@ -5676,7 +5677,7 @@ inline void gcode_G92() {
#if HAS_POSITION_SHIFT #if HAS_POSITION_SHIFT
const float p = current_position[i]; const float p = current_position[i];
#endif #endif
float v = parser.value_axis_units((AxisEnum)i); const float v = parser.value_axis_units((AxisEnum)i);
current_position[i] = v; current_position[i] = v;
@ -6405,7 +6406,7 @@ static bool pin_is_protected(const int8_t pin) {
inline void gcode_M42() { inline void gcode_M42() {
if (!parser.seen('S')) return; if (!parser.seen('S')) return;
int pin_status = parser.value_int(); const int pin_status = parser.value_int();
if (!WITHIN(pin_status, 0, 255)) return; if (!WITHIN(pin_status, 0, 255)) return;
int pin_number = parser.seen('P') ? parser.value_int() : LED_PIN; int pin_number = parser.seen('P') ? parser.value_int() : LED_PIN;
@ -6645,7 +6646,7 @@ inline void gcode_M42() {
*/ */
inline void gcode_M43() { inline void gcode_M43() {
if (parser.seen('T')) { // must be first or else it's "S" and "E" parameters will execute endstop or servo test if (parser.seen('T')) { // must be first or else its "S" and "E" parameters will execute endstop or servo test
toggle_pins(); toggle_pins();
return; return;
} }
@ -8580,7 +8581,7 @@ inline void gcode_M226() {
*/ */
inline void gcode_M280() { inline void gcode_M280() {
if (!parser.seen('P')) return; if (!parser.seen('P')) return;
int servo_index = parser.value_int(); const int servo_index = parser.value_int();
if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) { if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
if (parser.seen('S')) if (parser.seen('S'))
MOVE_SERVO(servo_index, parser.value_int()); MOVE_SERVO(servo_index, parser.value_int());
@ -8753,7 +8754,7 @@ inline void gcode_M226() {
* M302 S170 P1 ; set min extrude temp to 170 but leave disabled * M302 S170 P1 ; set min extrude temp to 170 but leave disabled
*/ */
inline void gcode_M302() { inline void gcode_M302() {
bool seen_S = parser.seen('S'); const bool seen_S = parser.seen('S');
if (seen_S) { if (seen_S) {
thermalManager.extrude_min_temp = parser.value_celsius(); thermalManager.extrude_min_temp = parser.value_celsius();
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0); thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
@ -8960,10 +8961,12 @@ inline void gcode_M400() { stepper.synchronize(); }
* M405: Turn on filament sensor for control * M405: Turn on filament sensor for control
*/ */
inline void gcode_M405() { inline void gcode_M405() {
// This is technically a linear measurement, but since it's quantized to centimeters and is a different unit than // This is technically a linear measurement, but since it's quantized to centimeters and is a different
// everything else, it uses parser.value_int() instead of parser.value_linear_units(). // unit than everything else, it uses parser.value_byte() instead of parser.value_linear_units().
if (parser.seen('D')) meas_delay_cm = parser.value_byte(); if (parser.seen('D')) {
meas_delay_cm = parser.value_byte();
NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY); NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY);
}
if (filwidth_delay_index[1] == -1) { // Initialize the ring buffer if not done since startup if (filwidth_delay_index[1] == -1) { // Initialize the ring buffer if not done since startup
const uint8_t temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte const uint8_t temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte

View file

@ -523,7 +523,7 @@ struct directoryEntry {
uint8_t reservedNT; uint8_t reservedNT;
/** /**
* The granularity of the seconds part of creationTime is 2 seconds * The granularity of the seconds part of creationTime is 2 seconds
* so this field is a count of tenths of a second and its valid * so this field is a count of tenths of a second and it's valid
* value range is 0-199 inclusive. (WHG note - seems to be hundredths) * value range is 0-199 inclusive. (WHG note - seems to be hundredths)
*/ */
uint8_t creationTimeTenths; uint8_t creationTimeTenths;

View file

@ -2,7 +2,7 @@
http://www.k8400.eu/ http://www.k8400.eu/
Configuration files for the K8400, ported upstream from the official Velleman firmware. Configuration files for the K8400, ported upstream from the official Velleman firmware.
Like it's predecessor, (K8200), the K8400 is a 3Drag clone. There are some minor differences, documented in pins_K8400.h. Like its predecessor, (K8200), the K8400 is a 3Drag clone. There are some minor differences, documented in pins_K8400.h.
Single and dual head configurations provided. Copy the correct Configuration.h and Configuration_adv.h to the /Marlin/ directory. Single and dual head configurations provided. Copy the correct Configuration.h and Configuration_adv.h to the /Marlin/ directory.

View file

@ -95,7 +95,7 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) { if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
*OCRnA = *TCNTn + SERVO(timer, Channel[timer]).ticks; *OCRnA = *TCNTn + SERVO(timer, Channel[timer]).ticks;
if (SERVO(timer, Channel[timer]).Pin.isActive) // check if activated if (SERVO(timer, Channel[timer]).Pin.isActive) // check if activated
digitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // its an active channel so pulse it high digitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // it's an active channel so pulse it high
} }
else { else {
// finished all channels so wait for the refresh period to expire before starting over // finished all channels so wait for the refresh period to expire before starting over

View file

@ -38,18 +38,18 @@ typedef void (*twiRequestFunc_t)();
/** /**
* TWIBUS class * TWIBUS class
* *
* This class implements a wrapper around the two wire (I2C) bus, it allows * This class implements a wrapper around the two wire (I2C) bus, allowing
* Marlin to send and request data from any slave device on the bus. This is * Marlin to send and request data from any slave device on the bus.
* an experimental feature and it's inner workings as well as public facing
* interface are prune to change in the future.
* *
* The two main consumers of this class are M260 and M261, where M260 allows * The two main consumers of this class are M260 and M261. M260 provides a way
* Marlin to send a I2C packet to a device (please be aware that no repeated * to send an I2C packet to a device (no repeated starts) by caching up to 32
* starts are possible), this can be done in caching method by calling multiple * bytes in a buffer and then sending the buffer.
* times M260 B<byte-1 value in base 10> or a one liner M260, have a look at * M261 requests data from a device. The received data is relayed to serial out
* the gcode_M260() function for more information. M261 allows Marlin to * for the host to interpret.
* request data from a device, the received data is then relayed into the serial *
* line for host interpretation. * For more information see
* - http://marlinfw.org/docs/gcode/M260.html
* - http://marlinfw.org/docs/gcode/M261.html
* *
*/ */
class TWIBus { class TWIBus {