Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-01-18 18:21:02 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-18 18:21:02 +0300
commite0bbf71357b07c22e6d43be3cca5c7422163be32 (patch)
treeca83dbb87348e51c735b106900b69142f5c058f5 /src/RepRap.cpp
parentd577af1d5874392d28c65427afbf4006f8a6d521 (diff)
Lock ZProbes when accessing them and added more items to OM
Diffstat (limited to 'src/RepRap.cpp')
-rw-r--r--src/RepRap.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/RepRap.cpp b/src/RepRap.cpp
index b57d291b..8b78e4bf 100644
--- a/src/RepRap.cpp
+++ b/src/RepRap.cpp
@@ -156,6 +156,7 @@ constexpr ObjectModelTableEntry RepRap::objectModelTable[] =
{ "job", OBJECT_MODEL_FUNC(self->printMonitor), ObjectModelEntryFlags::live },
{ "move", OBJECT_MODEL_FUNC(self->move), ObjectModelEntryFlags::live },
{ "network", OBJECT_MODEL_FUNC(self->network), ObjectModelEntryFlags::none },
+ { "sensors", OBJECT_MODEL_FUNC(&self->platform->GetEndstops()), ObjectModelEntryFlags::none },
{ "state", OBJECT_MODEL_FUNC(self, 1), ObjectModelEntryFlags::live },
{ "tools", OBJECT_MODEL_FUNC_NOSELF(&toolsArrayDescriptor), ObjectModelEntryFlags::live },
@@ -166,7 +167,7 @@ constexpr ObjectModelTableEntry RepRap::objectModelTable[] =
{ "upTime", OBJECT_MODEL_FUNC_NOSELF((int32_t)((millis64()/1000u) & 0x7FFFFFFF)), ObjectModelEntryFlags::live },
};
-constexpr uint8_t RepRap::objectModelTableDescriptor[] = { 2, 8, 4 };
+constexpr uint8_t RepRap::objectModelTableDescriptor[] = { 2, 9, 4 };
DEFINE_GET_OBJECT_MODEL_TABLE(RepRap)
@@ -1188,16 +1189,14 @@ OutputBuffer *RepRap::GetStatusResponse(uint8_t type, ResponseSource source) noe
response->cat(",\"sensors\":{");
// Probe
- const int v0 = platform->GetCurrentZProbe().GetReading();
- int v1, v2;
- switch (platform->GetCurrentZProbe().GetSecondaryValues(v1, v2))
+ const auto zp = platform->GetCurrentZProbe();
+ const int v0 = zp->GetReading();
+ int v1;
+ switch (zp->GetSecondaryValues(v1))
{
case 1:
response->catf("\"probeValue\":%d,\"probeSecondary\":[%d]", v0, v1);
break;
- case 2:
- response->catf("\"probeValue\":%d,\"probeSecondary\":[%d,%d]", v0, v1, v2);
- break;
default:
response->catf("\"probeValue\":%d", v0);
break;
@@ -1484,11 +1483,11 @@ OutputBuffer *RepRap::GetStatusResponse(uint8_t type, ResponseSource source) noe
/* Probe */
{
- const ZProbe& zp = platform->GetCurrentZProbe();
+ const auto zp = platform->GetCurrentZProbe();
// Trigger threshold, trigger height, type
response->catf(",\"probe\":{\"threshold\":%d,\"height\":%.2f,\"type\":%u}",
- zp.GetAdcValue(), (double)zp.GetConfiguredTriggerHeight(), (unsigned int)zp.GetProbeType());
+ zp->GetAdcValue(), (double)zp->GetConfiguredTriggerHeight(), (unsigned int)zp->GetProbeType());
}
/* Tool Mapping */
@@ -1916,16 +1915,14 @@ OutputBuffer *RepRap::GetLegacyStatusResponse(uint8_t type, int seq) noexcept
response->catf(",\"tool\":%d", GetCurrentToolNumber());
// Send the Z probe value
- const int v0 = platform->GetCurrentZProbe().GetReading();
- int v1, v2;
- switch (platform->GetCurrentZProbe().GetSecondaryValues(v1, v2))
+ const auto zp = platform->GetCurrentZProbe();
+ const int v0 = zp->GetReading();
+ int v1;
+ switch (zp->GetSecondaryValues(v1))
{
case 1:
response->catf(",\"probe\":\"%d (%d)\"", v0, v1);
break;
- case 2:
- response->catf(",\"probe\":\"%d (%d, %d)\"", v0, v1, v2);
- break;
default:
response->catf(",\"probe\":\"%d\"", v0);
break;