Limiting the application of Machine Limits

https://github.com/prusa3d/PrusaSlicer/issues/1212

WIP: The hints do not rescale when switching the "usage" combo box.
The new g-code time estimator needs to be updated to not read
the machine limits if not enabled.
This commit is contained in:
bubnikv 2020-10-02 17:31:55 +02:00
parent 0f44caa99c
commit 8df01818dd
11 changed files with 161 additions and 50 deletions

View file

@ -29,6 +29,13 @@ enum GCodeFlavor : unsigned char {
gcfSmoothie, gcfNoExtrusion,
};
enum class MachineLimitsUsage {
EmitToGCode,
TimeEstimateOnly,
Ignore,
Count,
};
enum PrintHostType {
htOctoPrint, htDuet, htFlashAir, htAstroBox
};
@ -102,6 +109,16 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get
return keys_map;
}
template<> inline const t_config_enum_values& ConfigOptionEnum<MachineLimitsUsage>::get_enum_values() {
static t_config_enum_values keys_map;
if (keys_map.empty()) {
keys_map["emit_to_gcode"] = int(MachineLimitsUsage::EmitToGCode);
keys_map["time_estimate_only"] = int(MachineLimitsUsage::TimeEstimateOnly);
keys_map["ignore"] = int(MachineLimitsUsage::Ignore);
}
return keys_map;
}
template<> inline const t_config_enum_values& ConfigOptionEnum<PrintHostType>::get_enum_values() {
static t_config_enum_values keys_map;
if (keys_map.empty()) {
@ -597,6 +614,8 @@ class MachineEnvelopeConfig : public StaticPrintConfig
{
STATIC_PRINT_CONFIG_CACHE(MachineEnvelopeConfig)
public:
// Allowing the machine limits to be completely ignored or used just for time estimator.
ConfigOptionEnum<MachineLimitsUsage> machine_limits_type;
// M201 X... Y... Z... E... [mm/sec^2]
ConfigOptionFloats machine_max_acceleration_x;
ConfigOptionFloats machine_max_acceleration_y;
@ -624,6 +643,7 @@ public:
protected:
void initialize(StaticCacheBase &cache, const char *base_ptr)
{
OPT_PTR(machine_limits_type);
OPT_PTR(machine_max_acceleration_x);
OPT_PTR(machine_max_acceleration_y);
OPT_PTR(machine_max_acceleration_z);