Enabled arcs render after adapting OpenCNCPilot code.

Started porting iosender to C++
This commit is contained in:
2023-05-16 09:18:06 +03:00
parent c05a6a1ad2
commit 42aefe8ed8
23 changed files with 2200 additions and 18 deletions
+43
View File
@@ -0,0 +1,43 @@
#pragma once
#include <string>
#include "grbl.h"
namespace iosender {
class MeasureViewModel {
public:
bool _isMetric = true;
const double MM_PER_INCH = 25.4;
bool IsMetric() const { return _isMetric; }
void IsMetric(bool value) {
if (value != _isMetric) {
_isMetric = value;
// trigger OnPropertyChanged()
}
}
std::string Unit() const { return _isMetric ? "mm" : "in"; }
std::string FeedrateUnit() const { return _isMetric ? "mm/min" : "in/min"; }
double UnitFactor() const { return _isMetric ? 1.0 : 25.4; }
std::string Format() const { return _isMetric ? GrblConstants::FORMAT_METRIC : GrblConstants::FORMAT_IMPERIAL; }
std::string FormatSigned() const { return "-" + Format(); }
int Precision() const { return _isMetric ? 3 : 4; }
double ConvertMM2Current(double value) const {
if (!_isMetric)
value /= 25.4;
return value;
}
};
}