mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-30 09:39:49 +02:00
Fixed a few more implicit casts, removed a few unused variables
This commit is contained in:
@@ -163,7 +163,7 @@ const int TOOL_LENGTH_OFFSET_AXIS = Z_AXIS; // Default z-axis. Valid values are
|
||||
// limits or angle between neighboring block line move directions. This is useful for machines that can't
|
||||
// tolerate the tool dwelling for a split second, i.e. 3d printers or laser cutters. If used, this value
|
||||
// should not be much greater than zero or to the minimum value necessary for the machine to work.
|
||||
const double MINIMUM_JUNCTION_SPEED = 0.0; // (mm/min)
|
||||
const float MINIMUM_JUNCTION_SPEED = 0.0f; // (mm/min)
|
||||
|
||||
// Sets the minimum feed rate the planner will allow. Any value below it will be set to this minimum
|
||||
// value. This also ensures that a planned motion always completes and accounts for any floating-point
|
||||
|
@@ -82,7 +82,7 @@ namespace Configuration {
|
||||
void JsonGenerator::item(const char* name, int& value, int32_t minValue, int32_t maxValue) {
|
||||
enter(name);
|
||||
char buf[32];
|
||||
_itoa(value, buf, 10);
|
||||
itoa(value, buf, 10);
|
||||
_encoder.begin_webui(name, _currentPath, "I", buf, minValue, maxValue);
|
||||
_encoder.end_object();
|
||||
leave();
|
||||
|
@@ -171,7 +171,7 @@ float limit_acceleration_by_axis_maximum(float* unit_vec) {
|
||||
for (idx = 0; idx < n_axis; idx++) {
|
||||
auto axisSetting = config->_axes->_axis[idx];
|
||||
if (unit_vec[idx] != 0) { // Avoid divide by zero.
|
||||
limit_value = MIN(limit_value, fabs(axisSetting->_acceleration / unit_vec[idx]));
|
||||
limit_value = MIN(limit_value, float(fabs(axisSetting->_acceleration / unit_vec[idx])));
|
||||
}
|
||||
}
|
||||
// The acceleration setting is stored and displayed in units of mm/sec^2,
|
||||
@@ -188,7 +188,7 @@ float limit_rate_by_axis_maximum(float* unit_vec) {
|
||||
for (idx = 0; idx < n_axis; idx++) {
|
||||
auto axisSetting = config->_axes->_axis[idx];
|
||||
if (unit_vec[idx] != 0) { // Avoid divide by zero.
|
||||
limit_value = MIN(limit_value, fabs(axisSetting->_maxRate / unit_vec[idx]));
|
||||
limit_value = MIN(limit_value, float(fabs(axisSetting->_maxRate / unit_vec[idx])));
|
||||
}
|
||||
}
|
||||
return limit_value;
|
||||
|
@@ -61,7 +61,7 @@ static inline int toMotor2(int axis) {
|
||||
|
||||
// Conversions
|
||||
const float MM_PER_INCH = (25.40f);
|
||||
const double INCH_PER_MM = (0.0393701);
|
||||
const float INCH_PER_MM = (0.0393701f);
|
||||
|
||||
// Useful macros
|
||||
#define clear_vector(a) memset(a, 0, sizeof(a))
|
||||
|
@@ -389,7 +389,7 @@ Error listAlarms(const char* value, WebUI::AuthenticationLevel auth_level, WebUI
|
||||
}
|
||||
if (value) {
|
||||
char* endptr = NULL;
|
||||
uint8_t alarmNumber = strtol(value, &endptr, 10);
|
||||
uint8_t alarmNumber = uint8_t(strtol(value, &endptr, 10));
|
||||
if (*endptr) {
|
||||
grbl_sendf(out->client(), "Malformed alarm number: %s\r\n", value);
|
||||
return Error::InvalidValue;
|
||||
@@ -418,7 +418,7 @@ const char* errorString(Error errorNumber) {
|
||||
Error listErrors(const char* value, WebUI::AuthenticationLevel auth_level, WebUI::ESPResponseStream* out) {
|
||||
if (value) {
|
||||
char* endptr = NULL;
|
||||
uint8_t errorNumber = strtol(value, &endptr, 10);
|
||||
uint8_t errorNumber = uint8_t(strtol(value, &endptr, 10));
|
||||
if (*endptr) {
|
||||
grbl_sendf(out->client(), "Malformed error number: %s\r\n", value);
|
||||
return Error::InvalidValue;
|
||||
|
@@ -201,7 +201,7 @@ static void report_util_axis_values(float* axis_value, char* rpt) {
|
||||
const char* format = "%4.3f"; // Default - report mm to 3 decimal places
|
||||
rpt[0] = '\0';
|
||||
if (config->_reportInches) {
|
||||
unit_conv = 1.0 / MM_PER_INCH;
|
||||
unit_conv = 1.0f / MM_PER_INCH;
|
||||
format = "%4.4f"; // Report inches to 4 decimal places
|
||||
}
|
||||
auto n_axis = config->_axes->_numberAxis;
|
||||
@@ -218,11 +218,10 @@ static void report_util_axis_values(float* axis_value, char* rpt) {
|
||||
static String report_util_axis_values(const float* axis_value) {
|
||||
String rpt = "";
|
||||
uint8_t idx;
|
||||
char axisVal[coordStringLen];
|
||||
float unit_conv = 1.0; // unit conversion multiplier..default is mm
|
||||
int decimals = 3; // Default - report mm to 3 decimal places
|
||||
if (config->_reportInches) {
|
||||
unit_conv = 1.0 / MM_PER_INCH;
|
||||
unit_conv = 1.0f / MM_PER_INCH;
|
||||
decimals = 4; // Report inches to 4 decimal places
|
||||
}
|
||||
auto n_axis = config->_axes->_numberAxis;
|
||||
|
@@ -28,7 +28,8 @@
|
||||
#include <SD.h>
|
||||
#include <SPI.h>
|
||||
|
||||
struct SDCard::FileWrap {
|
||||
class SDCard::FileWrap {
|
||||
public:
|
||||
FileWrap() : _file(nullptr) {}
|
||||
File _file;
|
||||
};
|
||||
|
@@ -235,7 +235,7 @@ void StringSetting::setDefault() {
|
||||
}
|
||||
|
||||
Error StringSetting::setStringValue(char* s) {
|
||||
if (_minLength && _maxLength && (strlen(s) < _minLength || strlen(s) > _maxLength)) {
|
||||
if (_minLength && _maxLength && (strlen(s) < size_t(_minLength) || strlen(s) > size_t(_maxLength))) {
|
||||
return Error::BadNumberFormat;
|
||||
}
|
||||
Error err = check(s);
|
||||
@@ -330,7 +330,7 @@ Error EnumSetting::setStringValue(char* s) {
|
||||
return Error::BadNumberFormat;
|
||||
}
|
||||
char* endptr;
|
||||
uint8_t num = strtol(s, &endptr, 10);
|
||||
uint8_t num = uint8_t(strtol(s, &endptr, 10));
|
||||
// Disallow non-numeric characters in string
|
||||
if (*endptr) {
|
||||
return Error::BadNumberFormat;
|
||||
|
@@ -153,7 +153,7 @@ namespace Spindles {
|
||||
}
|
||||
|
||||
// increase the precision (bits) until it exceeds allow by frequency the max or is 16
|
||||
while ((1 << precision) < (uint32_t)(80000000 / freq) && precision <= 16) {
|
||||
while ((1u << precision) < uint32_t(80000000 / freq) && precision <= 16) {
|
||||
precision++;
|
||||
}
|
||||
|
||||
|
@@ -79,18 +79,18 @@ namespace Spindles {
|
||||
offset = _speeds[i].percent / 100.0 * max_dev_speed;
|
||||
_speeds[i].offset = offset;
|
||||
|
||||
float deltaPercent = (_speeds[i + 1].percent - _speeds[i].percent) / 100.0;
|
||||
float deltaPercent = (_speeds[i + 1].percent - _speeds[i].percent) / 100.0f;
|
||||
float deltaRPM = _speeds[i + 1].speed - _speeds[i].speed;
|
||||
float scale = deltaRPM == 0.0 ? 0.0 : (deltaPercent / deltaRPM);
|
||||
float scale = deltaRPM == 0.0f ? 0.0f : (deltaPercent / deltaRPM);
|
||||
scale *= max_dev_speed;
|
||||
|
||||
// float scale = deltaPercent * max_dev_speed;
|
||||
scaler = scale * 65536;
|
||||
scaler = uint32_t(scale * 65536);
|
||||
_speeds[i].scale = scaler;
|
||||
}
|
||||
|
||||
// The final scaler is 0, with the offset equal to the ending offset
|
||||
offset = _speeds[nsegments].percent / 100.0 * max_dev_speed;
|
||||
offset = SpindleSpeed(_speeds[nsegments].percent / 100.0f * float(max_dev_speed));
|
||||
_speeds[i].offset = offset;
|
||||
scaler = 0;
|
||||
_speeds[i].scale = scaler;
|
||||
@@ -99,14 +99,14 @@ namespace Spindles {
|
||||
void Spindle::afterParse() {}
|
||||
|
||||
void Spindle::shelfSpeeds(SpindleSpeed min, SpindleSpeed max) {
|
||||
float minPercent = 100.0 * min / max;
|
||||
float minPercent = 100.0f * min / max;
|
||||
_speeds.clear();
|
||||
_speeds.push_back({ 0, 0.0 });
|
||||
_speeds.push_back({ 0, 0.0f });
|
||||
_speeds.push_back({ 0, minPercent });
|
||||
if (min) {
|
||||
_speeds.push_back({ min, minPercent });
|
||||
}
|
||||
_speeds.push_back({ max, 100.0 });
|
||||
_speeds.push_back({ max, 100.0f });
|
||||
}
|
||||
|
||||
uint32_t Spindle::mapSpeed(SpindleSpeed speed) {
|
||||
|
@@ -51,13 +51,13 @@ namespace Spindles {
|
||||
QueueHandle_t VFD::vfd_cmd_queue = nullptr;
|
||||
TaskHandle_t VFD::vfd_cmdTaskHandle = nullptr;
|
||||
|
||||
void VFD::reportParsingErrors(ModbusCommand cmd, uint8_t* rx_message, uint16_t read_length) {
|
||||
void VFD::reportParsingErrors(ModbusCommand cmd, uint8_t* rx_message, size_t read_length) {
|
||||
#ifdef DEBUG_VFD
|
||||
report_hex_msg(cmd.msg, "RS485 Tx: ", cmd.tx_length);
|
||||
report_hex_msg(rx_message, "RS485 Rx: ", read_length);
|
||||
#endif
|
||||
}
|
||||
void VFD::reportCmdErrors(ModbusCommand cmd, uint8_t* rx_message, uint16_t read_length, uint8_t id) {
|
||||
void VFD::reportCmdErrors(ModbusCommand cmd, uint8_t* rx_message, size_t read_length, uint8_t id) {
|
||||
#ifdef DEBUG_VFD
|
||||
report_hex_msg(cmd.msg, "RS485 Tx: ", cmd.tx_length);
|
||||
report_hex_msg(rx_message, "RS485 Rx: ", read_length);
|
||||
@@ -189,8 +189,8 @@ namespace Spindles {
|
||||
uart.flushTxTimed(response_ticks);
|
||||
|
||||
// Read the response
|
||||
uint16_t read_length = 0;
|
||||
uint16_t current_read = uart.readBytes(rx_message, next_cmd.rx_length, response_ticks);
|
||||
size_t read_length = 0;
|
||||
size_t current_read = uart.readBytes(rx_message, next_cmd.rx_length, response_ticks);
|
||||
read_length += current_read;
|
||||
|
||||
// Apparently some Huanyang report modbus errors in the correct way, and the rest not. Sigh.
|
||||
@@ -204,9 +204,6 @@ namespace Spindles {
|
||||
current_read = uart.readBytes(rx_message + read_length, next_cmd.rx_length - read_length, response_ticks);
|
||||
read_length += current_read;
|
||||
}
|
||||
if (current_read < 0) {
|
||||
read_length = 0;
|
||||
}
|
||||
|
||||
// Generate crc16 for the response:
|
||||
auto crc16response = ModRTU_CRC(rx_message, next_cmd.rx_length - 2);
|
||||
|
@@ -63,8 +63,8 @@ namespace Spindles {
|
||||
bool prepareSetModeCommand(SpindleState mode, ModbusCommand& data);
|
||||
bool prepareSetSpeedCommand(uint32_t speed, ModbusCommand& data);
|
||||
|
||||
static void reportParsingErrors(ModbusCommand cmd, uint8_t* rx_message, uint16_t read_length);
|
||||
static void reportCmdErrors(ModbusCommand cmd, uint8_t* rx_message, uint16_t read_length, uint8_t id);
|
||||
static void reportParsingErrors(ModbusCommand cmd, uint8_t* rx_message, size_t read_length);
|
||||
static void reportCmdErrors(ModbusCommand cmd, uint8_t* rx_message, size_t read_length, uint8_t id);
|
||||
|
||||
protected:
|
||||
// Commands:
|
||||
|
@@ -564,7 +564,7 @@ void st_prep_buffer() {
|
||||
pl_block->entry_speed_sqr = prep.exit_speed * prep.exit_speed;
|
||||
prep.recalculate_flag.decelOverride = 0;
|
||||
} else {
|
||||
prep.current_speed = sqrt(pl_block->entry_speed_sqr);
|
||||
prep.current_speed = float(sqrt(pl_block->entry_speed_sqr));
|
||||
}
|
||||
|
||||
// prep.inv_rate is only used if is_pwm_rate_adjusted is true
|
||||
@@ -573,7 +573,7 @@ void st_prep_buffer() {
|
||||
if (config->_laserMode) {
|
||||
if (pl_block->spindle == SpindleState::Ccw) {
|
||||
// Pre-compute inverse programmed rate to speed up PWM updating per step segment.
|
||||
prep.inv_rate = 1.0 / pl_block->programmed_rate;
|
||||
prep.inv_rate = 1.0f / pl_block->programmed_rate;
|
||||
st_prep_block->is_pwm_rate_adjusted = true;
|
||||
}
|
||||
}
|
||||
@@ -585,7 +585,7 @@ void st_prep_buffer() {
|
||||
hold, override the planner velocities and decelerate to the target exit speed.
|
||||
*/
|
||||
prep.mm_complete = 0.0; // Default velocity profile complete at 0.0mm from end of block.
|
||||
float inv_2_accel = 0.5 / pl_block->acceleration;
|
||||
float inv_2_accel = 0.5f / pl_block->acceleration;
|
||||
if (sys.step_control.executeHold) { // [Forced Deceleration to Zero Velocity]
|
||||
// Compute velocity profile parameters for a feed hold in-progress. This profile overrides
|
||||
// the planner block profile, enforcing a deceleration to zero speed.
|
||||
@@ -594,7 +594,7 @@ void st_prep_buffer() {
|
||||
float decel_dist = pl_block->millimeters - inv_2_accel * pl_block->entry_speed_sqr;
|
||||
if (decel_dist < 0.0) {
|
||||
// Deceleration through entire planner block. End of feed hold is not in this block.
|
||||
prep.exit_speed = sqrt(pl_block->entry_speed_sqr - 2 * pl_block->acceleration * pl_block->millimeters);
|
||||
prep.exit_speed = float(sqrt(pl_block->entry_speed_sqr - 2 * pl_block->acceleration * pl_block->millimeters));
|
||||
} else {
|
||||
prep.mm_complete = decel_dist; // End of feed hold.
|
||||
prep.exit_speed = 0.0;
|
||||
@@ -609,12 +609,12 @@ void st_prep_buffer() {
|
||||
prep.exit_speed = exit_speed_sqr = 0.0; // Enforce stop at end of system motion.
|
||||
} else {
|
||||
exit_speed_sqr = plan_get_exec_block_exit_speed_sqr();
|
||||
prep.exit_speed = sqrt(exit_speed_sqr);
|
||||
prep.exit_speed = float(sqrt(exit_speed_sqr));
|
||||
}
|
||||
|
||||
nominal_speed = plan_compute_profile_nominal_speed(pl_block);
|
||||
float nominal_speed_sqr = nominal_speed * nominal_speed;
|
||||
float intersect_distance = 0.5 * (pl_block->millimeters + inv_2_accel * (pl_block->entry_speed_sqr - exit_speed_sqr));
|
||||
float intersect_distance = 0.5f * (pl_block->millimeters + inv_2_accel * (pl_block->entry_speed_sqr - exit_speed_sqr));
|
||||
if (pl_block->entry_speed_sqr > nominal_speed_sqr) { // Only occurs during override reductions.
|
||||
prep.accelerate_until = pl_block->millimeters - inv_2_accel * (pl_block->entry_speed_sqr - nominal_speed_sqr);
|
||||
if (prep.accelerate_until <= 0.0) { // Deceleration-only.
|
||||
@@ -622,7 +622,7 @@ void st_prep_buffer() {
|
||||
// prep.decelerate_after = pl_block->millimeters;
|
||||
// prep.maximum_speed = prep.current_speed;
|
||||
// Compute override block exit speed since it doesn't match the planner exit speed.
|
||||
prep.exit_speed = sqrt(pl_block->entry_speed_sqr - 2 * pl_block->acceleration * pl_block->millimeters);
|
||||
prep.exit_speed = float(sqrt(pl_block->entry_speed_sqr - 2 * pl_block->acceleration * pl_block->millimeters));
|
||||
prep.recalculate_flag.decelOverride = 1; // Flag to load next block as deceleration override.
|
||||
// TODO: Determine correct handling of parameters in deceleration-only.
|
||||
// Can be tricky since entry speed will be current speed, as in feed holds.
|
||||
@@ -649,7 +649,7 @@ void st_prep_buffer() {
|
||||
} else { // Triangle type
|
||||
prep.accelerate_until = intersect_distance;
|
||||
prep.decelerate_after = intersect_distance;
|
||||
prep.maximum_speed = sqrt(2.0 * pl_block->acceleration * intersect_distance + exit_speed_sqr);
|
||||
prep.maximum_speed = float(sqrt(2.0f * pl_block->acceleration * intersect_distance + exit_speed_sqr));
|
||||
}
|
||||
} else { // Deceleration-only type
|
||||
prep.ramp_type = RAMP_DECEL;
|
||||
@@ -702,12 +702,12 @@ void st_prep_buffer() {
|
||||
switch (prep.ramp_type) {
|
||||
case RAMP_DECEL_OVERRIDE:
|
||||
speed_var = pl_block->acceleration * time_var;
|
||||
mm_var = time_var * (prep.current_speed - 0.5 * speed_var);
|
||||
mm_var = time_var * (prep.current_speed - 0.5f * speed_var);
|
||||
mm_remaining -= mm_var;
|
||||
if ((mm_remaining < prep.accelerate_until) || (mm_var <= 0)) {
|
||||
// Cruise or cruise-deceleration types only for deceleration override.
|
||||
mm_remaining = prep.accelerate_until; // NOTE: 0.0 at EOB
|
||||
time_var = 2.0 * (pl_block->millimeters - mm_remaining) / (prep.current_speed + prep.maximum_speed);
|
||||
time_var = 2.0f * (pl_block->millimeters - mm_remaining) / (prep.current_speed + prep.maximum_speed);
|
||||
prep.ramp_type = RAMP_CRUISE;
|
||||
prep.current_speed = prep.maximum_speed;
|
||||
} else { // Mid-deceleration override ramp.
|
||||
@@ -717,11 +717,11 @@ void st_prep_buffer() {
|
||||
case RAMP_ACCEL:
|
||||
// NOTE: Acceleration ramp only computes during first do-while loop.
|
||||
speed_var = pl_block->acceleration * time_var;
|
||||
mm_remaining -= time_var * (prep.current_speed + 0.5 * speed_var);
|
||||
mm_remaining -= time_var * (prep.current_speed + 0.5f * speed_var);
|
||||
if (mm_remaining < prep.accelerate_until) { // End of acceleration ramp.
|
||||
// Acceleration-cruise, acceleration-deceleration ramp junction, or end of block.
|
||||
mm_remaining = prep.accelerate_until; // NOTE: 0.0 at EOB
|
||||
time_var = 2.0 * (pl_block->millimeters - mm_remaining) / (prep.current_speed + prep.maximum_speed);
|
||||
time_var = 2.0f * (pl_block->millimeters - mm_remaining) / (prep.current_speed + prep.maximum_speed);
|
||||
if (mm_remaining == prep.decelerate_after) {
|
||||
prep.ramp_type = RAMP_DECEL;
|
||||
} else {
|
||||
@@ -751,15 +751,15 @@ void st_prep_buffer() {
|
||||
speed_var = pl_block->acceleration * time_var; // Used as delta speed (mm/min)
|
||||
if (prep.current_speed > speed_var) { // Check if at or below zero speed.
|
||||
// Compute distance from end of segment to end of block.
|
||||
mm_var = mm_remaining - time_var * (prep.current_speed - 0.5 * speed_var); // (mm)
|
||||
if (mm_var > prep.mm_complete) { // Typical case. In deceleration ramp.
|
||||
mm_var = mm_remaining - time_var * (prep.current_speed - 0.5f * speed_var); // (mm)
|
||||
if (mm_var > prep.mm_complete) { // Typical case. In deceleration ramp.
|
||||
mm_remaining = mm_var;
|
||||
prep.current_speed -= speed_var;
|
||||
break; // Segment complete. Exit switch-case statement. Continue do-while loop.
|
||||
}
|
||||
}
|
||||
// Otherwise, at end of block or end of forced-deceleration.
|
||||
time_var = 2.0 * (mm_remaining - prep.mm_complete) / (prep.current_speed + prep.exit_speed);
|
||||
time_var = 2.0f * (mm_remaining - prep.mm_complete) / (prep.current_speed + prep.exit_speed);
|
||||
mm_remaining = prep.mm_complete;
|
||||
prep.current_speed = prep.exit_speed;
|
||||
}
|
||||
@@ -802,7 +802,6 @@ void st_prep_buffer() {
|
||||
sys.step_control.updateSpindleSpeed = false;
|
||||
}
|
||||
prep_segment->spindle_speed = prep.current_spindle_speed;
|
||||
bool enabled;
|
||||
prep_segment->spindle_dev_speed = spindle->mapSpeed(prep.current_spindle_speed); // Reload segment PWM value
|
||||
|
||||
/* -----------------------------------------------------------------------------------
|
||||
@@ -815,10 +814,10 @@ void st_prep_buffer() {
|
||||
Fortunately, this scenario is highly unlikely and unrealistic in CNC machines
|
||||
supported by Grbl (i.e. exceeding 10 meters axis travel at 200 step/mm).
|
||||
*/
|
||||
float step_dist_remaining = prep.step_per_mm * mm_remaining; // Convert mm_remaining to steps
|
||||
float n_steps_remaining = ceil(step_dist_remaining); // Round-up current steps remaining
|
||||
float last_n_steps_remaining = ceil(prep.steps_remaining); // Round-up last steps remaining
|
||||
prep_segment->n_step = last_n_steps_remaining - n_steps_remaining; // Compute number of steps to execute.
|
||||
float step_dist_remaining = prep.step_per_mm * mm_remaining; // Convert mm_remaining to steps
|
||||
float n_steps_remaining = float(ceil(step_dist_remaining)); // Round-up current steps remaining
|
||||
float last_n_steps_remaining = float(ceil(prep.steps_remaining)); // Round-up last steps remaining
|
||||
prep_segment->n_step = uint16_t(last_n_steps_remaining - n_steps_remaining); // Compute number of steps to execute.
|
||||
|
||||
// Bail if we are at the end of a feed hold and don't have a step to execute.
|
||||
if (prep_segment->n_step == 0) {
|
||||
@@ -849,7 +848,7 @@ void st_prep_buffer() {
|
||||
// Compute CPU cycles per step for the prepped segment.
|
||||
// fStepperTimer is in units of timerTicks/sec, so the dimensional analysis is
|
||||
// timerTicks/sec * 60 sec/minute * minutes = timerTicks
|
||||
uint32_t timerTicks = ceil((fStepperTimer * 60) * inv_rate); // (timerTicks/step)
|
||||
uint32_t timerTicks = uint32_t(ceil((fStepperTimer * 60) * inv_rate)); // (timerTicks/step)
|
||||
int level;
|
||||
|
||||
// Compute step timing and multi-axis smoothing level.
|
||||
|
@@ -9,12 +9,12 @@
|
||||
const int SEGMENT_BUFFER_SIZE = 6;
|
||||
|
||||
// Some useful constants.
|
||||
const double DT_SEGMENT = (1.0 / (ACCELERATION_TICKS_PER_SECOND * 60.0)); // min/segment
|
||||
const double REQ_MM_INCREMENT_SCALAR = 1.25;
|
||||
const int RAMP_ACCEL = 0;
|
||||
const int RAMP_CRUISE = 1;
|
||||
const int RAMP_DECEL = 2;
|
||||
const int RAMP_DECEL_OVERRIDE = 3;
|
||||
const float DT_SEGMENT = (1.0f / (float(ACCELERATION_TICKS_PER_SECOND) * 60.0f)); // min/segment
|
||||
const float REQ_MM_INCREMENT_SCALAR = 1.25f;
|
||||
const int RAMP_ACCEL = 0;
|
||||
const int RAMP_CRUISE = 1;
|
||||
const int RAMP_DECEL = 2;
|
||||
const int RAMP_DECEL_OVERRIDE = 3;
|
||||
|
||||
struct PrepFlag {
|
||||
uint8_t recalculate : 1;
|
||||
|
@@ -140,7 +140,7 @@ void sys_analog_all_off() {
|
||||
// io_num is the virtual analog pin#
|
||||
bool sys_set_analog(uint8_t io_num, float percent) {
|
||||
auto analog = myAnalogOutputs[io_num];
|
||||
uint32_t numerator = percent / 100.0 * analog->denominator();
|
||||
uint32_t numerator = uint32_t(percent / 100.0f * analog->denominator());
|
||||
return analog->set_level(numerator);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ uint8_t sys_calc_pwm_precision(uint32_t freq) {
|
||||
uint8_t precision = 0;
|
||||
|
||||
// increase the precision (bits) until it exceeds allow by frequency the max or is 16
|
||||
while ((1 << precision) < (uint32_t)(80000000 / freq) && precision <= 16) { // TODO is there a named value for the 80MHz?
|
||||
while ((1u << precision) < uint32_t(80000000 / freq) && precision <= 16) { // TODO is there a named value for the 80MHz?
|
||||
precision++;
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ namespace UserOutput {
|
||||
|
||||
// increase the precision (bits) until it exceeds allow by frequency the max or is 16
|
||||
_resolution_bits = 0;
|
||||
while ((1 << _resolution_bits) < (apb_frequency / _pwm_frequency) && _resolution_bits <= 16) {
|
||||
while ((1u << _resolution_bits) < (apb_frequency / _pwm_frequency) && _resolution_bits <= 16) {
|
||||
++_resolution_bits;
|
||||
}
|
||||
// _resolution_bits is now just barely too high, so drop it down one
|
||||
|
@@ -35,7 +35,7 @@ namespace UserOutput {
|
||||
void config_message();
|
||||
|
||||
uint8_t _number = UNDEFINED_OUTPUT;
|
||||
Pin& _pin;
|
||||
Pin& _pin;
|
||||
};
|
||||
|
||||
class AnalogOutput {
|
||||
@@ -49,7 +49,7 @@ namespace UserOutput {
|
||||
void config_message();
|
||||
|
||||
uint8_t _number = UNDEFINED_OUTPUT;
|
||||
Pin& _pin;
|
||||
Pin& _pin;
|
||||
uint8_t _pwm_channel = -1; // -1 means invalid or not setup
|
||||
float _pwm_frequency;
|
||||
uint8_t _resolution_bits;
|
||||
|
@@ -58,7 +58,7 @@ namespace WebUI {
|
||||
}
|
||||
|
||||
//no space allowed
|
||||
for (int i = 0; i < strlen(password); i++) {
|
||||
for (size_t i = 0; i < strlen(password); i++) {
|
||||
c = password[i];
|
||||
if (c == ' ') {
|
||||
return false;
|
||||
|
@@ -324,6 +324,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)X86TestSupport;$(MSBuildThisFileDirectory)GRBL_Esp32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-D_CRT_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -341,6 +342,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)X86TestSupport;$(MSBuildThisFileDirectory)GRBL_Esp32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-D_CRT_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -357,6 +359,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)X86TestSupport;$(MSBuildThisFileDirectory)GRBL_Esp32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>-D_CRT_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -375,6 +378,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)X86TestSupport;$(MSBuildThisFileDirectory)GRBL_Esp32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>-D_CRT_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -389,4 +393,4 @@
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user