diff options
author | David Crocker <dcrocker@eschertech.com> | 2017-02-10 20:34:06 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2017-02-10 20:34:06 +0300 |
commit | 8e5c83a186d1ee17cc9d295089dffae79dcbff7e (patch) | |
tree | b126f05b9105b1bd8aac8b227905bad4aaeca0a0 /src | |
parent | 8f6d8e9da77f8442d7f8e05d6362ddfac8e43b8f (diff) |
Release 1.17e
Fixed divide by zero bug in LWIP (affected Duet 085 build only)
G29 S1 now clears bed transform before loading height map
M122 software reset data now includes a stack dump if the reason was a
hard fault
M122 now reports the type of bed compensation in use
Diffstat (limited to 'src')
-rw-r--r-- | src/Duet/Lwip/lwip/src/core/ipv4/igmp.c | 5 | ||||
-rw-r--r-- | src/DuetNG/DuetEthernet/Socket.cpp | 6 | ||||
-rw-r--r-- | src/GCodes/GCodes.cpp | 2 | ||||
-rw-r--r-- | src/Movement/Move.cpp | 11 | ||||
-rw-r--r-- | src/Platform.cpp | 21 | ||||
-rw-r--r-- | src/Platform.h | 14 | ||||
-rw-r--r-- | src/Version.h | 4 |
7 files changed, 49 insertions, 14 deletions
diff --git a/src/Duet/Lwip/lwip/src/core/ipv4/igmp.c b/src/Duet/Lwip/lwip/src/core/ipv4/igmp.c index 88041996..ccb5d737 100644 --- a/src/Duet/Lwip/lwip/src/core/ipv4/igmp.c +++ b/src/Duet/Lwip/lwip/src/core/ipv4/igmp.c @@ -697,12 +697,16 @@ igmp_timeout(struct igmp_group *group) static void igmp_start_timer(struct igmp_group *group, u8_t max_time) { +#if 1 // dc42 fix for divide by zero error (this has been confirmed to occur in Duet085 firmware 1.17d) + group->timer = (max_time > 2) ? (LWIP_RAND() % (max_time - 1)) + 1 : 1; +#else /* ensure the input value is > 0 */ if (max_time == 0) { max_time = 1; } /* ensure the random value is > 0 */ group->timer = (LWIP_RAND() % (max_time - 1)) + 1; +#endif } /** @@ -722,7 +726,6 @@ igmp_delaying_member(struct igmp_group *group, u8_t maxresp) } } - /** * Sends an IP packet on a network interface. This function constructs the IP header * and calculates the IP header checksum. If the source IP address is NULL, diff --git a/src/DuetNG/DuetEthernet/Socket.cpp b/src/DuetNG/DuetEthernet/Socket.cpp index feba6b73..d913300c 100644 --- a/src/DuetNG/DuetEthernet/Socket.cpp +++ b/src/DuetNG/DuetEthernet/Socket.cpp @@ -147,6 +147,12 @@ bool Socket::ReadBuffer(const char *&buffer, size_t &len) // Poll a socket to see if it needs to be serviced void Socket::Poll(bool full) { + // Recycle any receive buffers that are now empty + while (receivedData != nullptr && receivedData->IsEmpty()) + { + receivedData = receivedData->Release(); // discard empty buffer at head of chain + } + switch(getSn_SR(socketNum)) { case SOCK_INIT: diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 35c8714e..85c41f54 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -2237,6 +2237,7 @@ bool GCodes::ProbeGrid(GCodeBuffer& gb, StringRef& reply) bool GCodes::LoadHeightMap(GCodeBuffer& gb, StringRef& reply) const { + reprap.GetMove()->SetIdentityTransform(); // stop using old-style bed compensation and clear the height map const char* heightMapFileName; if (gb.Seen('P')) { @@ -2247,7 +2248,6 @@ bool GCodes::LoadHeightMap(GCodeBuffer& gb, StringRef& reply) const heightMapFileName = DefaultHeightMapFile; } FileStore * const f = platform->GetFileStore(platform->GetSysDir(), heightMapFileName, false); - if (f == nullptr) { reply.printf("Height map file %s not found", heightMapFileName); diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index ab419fdd..e2334a45 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -414,7 +414,16 @@ void Move::Diagnostics(MessageType mtype) numLookaheadUnderruns = numPrepareUnderruns = 0; longestGcodeWaitInterval = 0; - // Show the current probe position heights + // Show the current probe position heights and type of bed compensation in use + p->Message(mtype, "Bed compensation in use: "); + if (numBedCompensationPoints == 0) + { + p->MessageF(mtype, "%s\n", (grid.UsingHeightMap()) ? "mesh" : "none"); + } + else + { + p->MessageF(mtype, "%d point\n", numBedCompensationPoints); + } p->Message(mtype, "Bed probe heights:"); for (size_t i = 0; i < MaxProbePoints; ++i) { diff --git a/src/Platform.cpp b/src/Platform.cpp index 06b3b6b8..7b9e479f 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -146,7 +146,7 @@ extern "C" // Also get the program counter when the exception occurred. void prvGetRegistersFromStack(const uint32_t *pulFaultStackAddress) { - reprap.GetPlatform()->SoftwareReset((uint16_t)SoftwareResetReason::hardFault, pulFaultStackAddress + 6); + reprap.GetPlatform()->SoftwareReset((uint16_t)SoftwareResetReason::hardFault, pulFaultStackAddress + 5); } // The fault handler implementation calls a function called prvGetRegistersFromStack() @@ -400,7 +400,7 @@ void Platform::Init() break; } - // Initialise TMC2660 drivers + // Initialise TMC2660 driver module driversPowered = false; TMC2660::Init(ENABLE_PINS, numTMC2660Drivers); #endif @@ -1278,12 +1278,14 @@ void Platform::SoftwareReset(uint16_t reason, const uint32_t *stk) } srdBuf[slot].magic = SoftwareResetData::magicValue; srdBuf[slot].resetReason = reason; - GetStackUsage(NULL, NULL, &srdBuf[slot].neverUsedRam); + GetStackUsage(nullptr, nullptr, &srdBuf[slot].neverUsedRam); srdBuf[slot].hfsr = SCB->HFSR; srdBuf[slot].cfsr = SCB->CFSR; srdBuf[slot].icsr = SCB->ICSR; + srdBuf[slot].bfar = SCB->BFAR; if (stk != nullptr) { + srdBuf[slot].sp = reinterpret_cast<uint32_t>(stk); for (size_t i = 0; i < ARRAY_SIZE(srdBuf[slot].stack); ++i) { srdBuf[slot].stack[i] = stk[i]; @@ -1458,8 +1460,8 @@ void Platform::Diagnostics(MessageType mtype) { scratchString.catf(" %08x", srdBuf[slot].stack[i]); } - MessageF(mtype, "0x%04x, HFSR 0x%08x, CFSR 0x%08x, ICSR 0x%08x\nStack:%s\n", - srdBuf[slot].resetReason, srdBuf[slot].hfsr, srdBuf[slot].cfsr, srdBuf[slot].icsr, scratchString.Pointer()); + MessageF(mtype, "0x%04x, HFSR 0x%08x, CFSR 0x%08x, ICSR 0x%08x, BFAR 0x%08x, SP 0x%08x\nStack:%s\n", + srdBuf[slot].resetReason, srdBuf[slot].hfsr, srdBuf[slot].cfsr, srdBuf[slot].icsr, srdBuf[slot].bfar, srdBuf[slot].sp, scratchString.Pointer()); MessageF(mtype, "Spinning module during software reset: %s, available RAM %u bytes (slot %d)\n", moduleName[srdBuf[slot].resetReason & 0x0F], srdBuf[slot].neverUsedRam, slot); } @@ -1593,6 +1595,15 @@ void Platform::DiagnosticTest(int d) (void)RepRap::ReadDword(reinterpret_cast<const char*>(dummy) + 1); // call function in another module so it can't be optimised away break; + case (int)DiagnosticTestType::BusFault: + // Read from the "Undefined (Abort)" area +#ifdef DUET_NG + (void)RepRap::ReadDword(reinterpret_cast<const char*>(0x20800000)); +#else + (void)RepRap::ReadDword(reinterpret_cast<const char*>(0x20200000)); +#endif + break; + case (int)DiagnosticTestType::PrintMoves: DDA::PrintMoves(); break; diff --git a/src/Platform.h b/src/Platform.h index 52f7d453..869d05d0 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -175,6 +175,7 @@ enum class DiagnosticTestType : int TestSerialBlock = 1003, // test what happens when we write a blocking message via debugPrintf() DivideByZero = 1004, // do an integer divide by zero to test exception handling UnalignedMemoryAccess = 1005, // do an unaligned memory access to test exception handling + BusFault = 1006, // generate a bus fault PrintMoves = 100, // print summary of recent moves #ifdef DUET_NG @@ -610,9 +611,12 @@ private: // directly from/to flash memory. struct SoftwareResetData { - static const uint16_t versionValue = 6; // increment this whenever this struct changes + static const uint16_t versionValue = 7; // increment this whenever this struct changes static const uint16_t magicValue = 0x7D00 | versionValue; // value we use to recognise that all the flash data has been written - static const size_t numberOfSlots = 6; // number of storage slots used to implement wear levelling +#ifndef DUET_NG + static const uint32_t nvAddress = 0; // must be 4-byte aligned +#endif + static const size_t numberOfSlots = 5; // number of storage slots used to implement wear levelling - must fit in 512 bytes uint16_t magic; // the magic number, including the version uint16_t resetReason; // this records why we did a software reset, for diagnostic purposes @@ -620,7 +624,9 @@ private: uint32_t hfsr; // hard fault status register uint32_t cfsr; // configurable fault status register uint32_t icsr; // interrupt control and state register - uint32_t stack[16]; // stack when the exception occurred, with the program counter at the bottom + uint32_t bfar; // bus fault address register + uint32_t sp; // stack pointer + uint32_t stack[18]; // stack when the exception occurred, with the program counter at the bottom bool isVacant() const // return true if this struct can be written without erasing it first { @@ -1262,7 +1268,7 @@ inline float Platform::AdcReadingToPowerVoltage(uint16_t adcVal) // The PC and PD bit numbers don't overlap, so we use their actual positions. // PA0 clashes with PD0, so we use bit 1 to represent PA0. // RADDS: -// To be done +// Step pins are distributed over all 4 ports, but they are in different bit positions except for port C // Calculate the step bit for a driver. This doesn't need to be fast. /*static*/ inline uint32_t Platform::CalcDriverBitmap(size_t driver) diff --git a/src/Version.h b/src/Version.h index fa8bf2e9..d7aa8890 100644 --- a/src/Version.h +++ b/src/Version.h @@ -9,11 +9,11 @@ #define SRC_VERSION_H_ #ifndef VERSION -# define VERSION "1.17d+1" +# define VERSION "1.17e" #endif #ifndef DATE -# define DATE "2017-02-01" +# define DATE "2017-02-10" #endif #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman" |