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
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2022-09-05 15:41:22 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-09-05 15:41:22 +0300
commita2179fb890991f68375a94a4ffd80d57a4ec44fa (patch)
tree80749a6b757b322b71d27b494124ca5b088bcebb /src
parente39d3ad2767a2404fa59c03a494b3d5ad7c5c841 (diff)
Allow negative (i.e. high) values in M122 P1007
Diffstat (limited to 'src')
-rw-r--r--src/CAN/CanInterface.cpp6
-rw-r--r--src/Platform/Platform.cpp8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp
index 96bfd602..6bcdb362 100644
--- a/src/CAN/CanInterface.cpp
+++ b/src/CAN/CanInterface.cpp
@@ -1173,10 +1173,10 @@ GCodeResult CanInterface::RemoteDiagnostics(MessageType mt, uint32_t boardAddres
if (type == (uint16_t)DiagnosticTestType::AccessMemory)
{
gb.MustSee('A');
- msg->param32[0] = gb.GetUIValue();
+ msg->param32[0] = (uint32_t)gb.GetIValue(); // allow negative values so that we can read high memory addresses
if (gb.Seen('V'))
{
- msg->param32[1] = gb.GetUIValue();
+ msg->param32[1] = (uint32_t)gb.GetIValue(); // allow negative values so that we set high values
msg->param16 = 1;
}
else
@@ -1184,7 +1184,7 @@ GCodeResult CanInterface::RemoteDiagnostics(MessageType mt, uint32_t boardAddres
msg->param16 = 0;
}
}
- return SendRequestAndGetStandardReply(buf, rid, reply); // we may not actually get a reply if the test is one that crashes the expansion board
+ return SendRequestAndGetStandardReply(buf, rid, reply); // we may not actually get a reply if the test is one that crashes the expansion board
}
GCodeResult CanInterface::RemoteM408(uint32_t boardAddress, unsigned int type, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException)
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp
index 9c392fb1..15ead4cd 100644
--- a/src/Platform/Platform.cpp
+++ b/src/Platform/Platform.cpp
@@ -2035,16 +2035,16 @@ GCodeResult Platform::DiagnosticTest(GCodeBuffer& gb, const StringRef& reply, Ou
case (unsigned int)DiagnosticTestType::AccessMemory:
{
gb.MustSee('A');
- uint32_t address = gb.GetUIValue();
+ uint32_t address = (uint32_t)gb.GetIValue(); // allow negative values here so that we can read high addresses
unsigned int numValues = (gb.Seen('R')) ? gb.GetUIValue() : 1;
- uint32_t val;
+ int32_t val;
bool dummy;
deliberateError = true; // in case the memory access causes a fault
- if (gb.TryGetUIValue('V', val, dummy))
+ if (gb.TryGetIValue('V', val, dummy)) // allow negative values so that we can use values like 0xffffffff
{
while (numValues != 0)
{
- *reinterpret_cast<uint32_t*>(address) = val;
+ *reinterpret_cast<uint32_t*>(address) = (uint32_t)val;
address += 4;
--numValues;
}