diff options
Diffstat (limited to 'src')
30 files changed, 214 insertions, 202 deletions
diff --git a/src/Comms/PanelDueUpdater.h b/src/Comms/PanelDueUpdater.h index f03cd43b..cf0634c6 100644 --- a/src/Comms/PanelDueUpdater.h +++ b/src/Comms/PanelDueUpdater.h @@ -23,8 +23,8 @@ constexpr uint32_t RequiredBaudRate = 115200; -constexpr const char * panelDueCommandEraseAndReset = "{\"controlCommand\":\"eraseAndReset\"}\n"; -constexpr const char * panelDueCommandReset = "{\"controlCommand\":\"reset\"}\n"; +constexpr const char *_ecv_array panelDueCommandEraseAndReset = "{\"controlCommand\":\"eraseAndReset\"}\n"; +constexpr const char *_ecv_array panelDueCommandReset = "{\"controlCommand\":\"reset\"}\n"; constexpr uint16_t WaitMsAfterEraseAndReset = 2000; // How long to wait in ms after eraseAndReset diff --git a/src/Configuration.h b/src/Configuration.h index acd694fe..893477f1 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -23,7 +23,7 @@ Licence: GPL #include <cstring> // for strlen // Axes -constexpr float DefaultXYMaxFeedrate = 100; // mm/sec +constexpr float DefaultXYMaxFeedrate = 100.0; // mm/sec constexpr float DefaultZMaxFeedrate = 5.0; constexpr float DefaultEMaxFeedrate = 20.0; @@ -213,7 +213,7 @@ constexpr size_t ObjectNamesStringSpace = 500; // How much space we reserve fo // Move system constexpr float DefaultFeedRate = 3000.0; // The initial requested feed rate after resetting the printer, in mm/min -constexpr float DefaultG0FeedRate = 18000; // The initial feed rate for G0 commands after resetting the printer, in mm/min +constexpr float DefaultG0FeedRate = 18000.0; // The initial feed rate for G0 commands after resetting the printer, in mm/min constexpr float MinRetractSpeed = 60.0; // The minimum firmware retraction/un-retraction speed in mm/min constexpr float DefaultRetractSpeed = 1000.0; // The default firmware retraction and un-retraction speed, in mm/min constexpr float DefaultRetractLength = 2.0; @@ -221,8 +221,8 @@ constexpr float DefaultRetractLength = 2.0; constexpr float MaxArcDeviation = 0.005; // maximum deviation from ideal arc due to segmentation constexpr float MinArcSegmentLength = 0.1; // G2 and G3 arc movement commands get split into segments at least this long constexpr float MaxArcSegmentLength = 1.0; // G2 and G3 arc movement commands get split into segments at most this long -constexpr float MinArcSegmentsPerSec = 200; -constexpr float SegmentsPerFulArcCalculation = 8; // we do the full sine/cosine calculation every this number of segments +constexpr float MinArcSegmentsPerSec = 200.0; +constexpr float SegmentsPerFulArcCalculation = 8.0; // we do the full sine/cosine calculation every this number of segments constexpr uint32_t DefaultIdleTimeout = 30000; // Milliseconds constexpr float DefaultIdleCurrentFactor = 0.3; // Proportion of normal motor current that we use for idle hold diff --git a/src/Fans/Fan.h b/src/Fans/Fan.h index b1af0d11..74da625f 100644 --- a/src/Fans/Fan.h +++ b/src/Fans/Fan.h @@ -21,7 +21,7 @@ class GCodeBuffer; class Fan INHERIT_OBJECT_MODEL { public: - Fan(unsigned int fanNum) noexcept; + explicit Fan(unsigned int fanNum) noexcept; Fan(const Fan&) = delete; virtual ~Fan() noexcept { } @@ -56,7 +56,7 @@ public: GCodeResult SetPwm(float speed, const StringRef& reply) noexcept; bool HasMonitoredSensors() const noexcept { return sensorsMonitored.IsNonEmpty(); } unsigned int GetNumber() const { return fanNumber; } - const char *GetName() const noexcept { return name.c_str(); } + const char *_ecv_array GetName() const noexcept { return name.c_str(); } #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE bool WriteSettings(FileStore *f, size_t fanNum) const noexcept; // save the settings of this fan if it isn't thermostatic diff --git a/src/GCodes/GCodeException.h b/src/GCodes/GCodeException.h index 67f8f6ad..c1129c34 100644 --- a/src/GCodes/GCodeException.h +++ b/src/GCodes/GCodeException.h @@ -19,7 +19,7 @@ namespace StackUsage class GCodeException { public: - GCodeException(const char *msg) noexcept: line(-1), column(-1), message(msg), haveStringParam(false) { } + explicit GCodeException(const char *msg) noexcept: line(-1), column(-1), message(msg), haveStringParam(false) { } GCodeException(int lin, int col, const char *msg) noexcept : line(lin), column(col), message(msg), haveStringParam(false) { } diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp index 84fce3a0..5bb9fdb3 100644 --- a/src/Hardware/ExceptionHandlers.cpp +++ b/src/Hardware/ExceptionHandlers.cpp @@ -83,7 +83,7 @@ #elif !SAME5x RSTC->RSTC_MR = RSTC_MR_KEY_PASSWD; // ignore any signal on the NRST pin for now so that the reset reason will show as Software #endif - Reset(); + ResetProcessor(); for(;;) {} } diff --git a/src/Hardware/SAM4E/PinDescription.h b/src/Hardware/SAM4E/PinDescription.h index 85bfa0cc..0144470d 100644 --- a/src/Hardware/SAM4E/PinDescription.h +++ b/src/Hardware/SAM4E/PinDescription.h @@ -40,10 +40,10 @@ constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexc struct PinDescription : public PinDescriptionBase { PinCapability cap; - const char* pinNames; + const char* _ecv_array null pinNames; PinCapability GetCapability() const noexcept { return cap; } - const char* GetNames() const noexcept { return pinNames; } + const char* _ecv_array null GetNames() const noexcept { return pinNames; } }; #endif /* SRC_HARDWARE_SAM4E_PINDESCRIPTION_H_ */ diff --git a/src/Hardware/SAM4S/PinDescription.h b/src/Hardware/SAM4S/PinDescription.h index 6f552cff..f0a059a6 100644 --- a/src/Hardware/SAM4S/PinDescription.h +++ b/src/Hardware/SAM4S/PinDescription.h @@ -15,19 +15,19 @@ enum class PinCapability: uint8_t { // Individual capabilities - none = 0, - read = 1, - ain = 2, - write = 4, - pwm = 8, + none = 0u, + read = 1u, + ain = 2u, + write = 4u, + pwm = 8u, // Combinations - ainr = 1|2, - rw = 1|4, - wpwm = 4|8, - rwpwm = 1|4|8, - ainrw = 1|2|4, - ainrwpwm = 1|2|4|8 + ainr = 1u|2u, + rw = 1u|4u, + wpwm = 4u|8u, + rwpwm = 1u|4u|8u, + ainrw = 1u|2u|4u, + ainrwpwm = 1u|2u|4u|8u }; constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexcept @@ -40,10 +40,10 @@ constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexc struct PinDescription : public PinDescriptionBase { PinCapability cap; - const char* pinNames; + const char* _ecv_array null pinNames; PinCapability GetCapability() const noexcept { return cap; } - const char* GetNames() const noexcept { return pinNames; } + const char* _ecv_array null GetNames() const noexcept { return pinNames; } }; #endif /* SRC_HARDWARE_SAM4S_PINDESCRIPTION_H_ */ diff --git a/src/Hardware/SAME5x/PinDescription.h b/src/Hardware/SAME5x/PinDescription.h index 23e836c0..2e1b7558 100644 --- a/src/Hardware/SAME5x/PinDescription.h +++ b/src/Hardware/SAME5x/PinDescription.h @@ -15,19 +15,19 @@ enum class PinCapability: uint8_t { // Individual capabilities - none = 0, - read = 1, - ain = 2, - write = 4, - pwm = 8, + none = 0u, + read = 1u, + ain = 2u, + write = 4u, + pwm = 8u, // Combinations - ainr = 1|2, - rw = 1|4, - wpwm = 4|8, - rwpwm = 1|4|8, - ainrw = 1|2|4, - ainrwpwm = 1|2|4|8 + ainr = 1u|2u, + rw = 1u|4u, + wpwm = 4u|8u, + rwpwm = 1u|4u|8u, + ainrw = 1u|2u|4u, + ainrwpwm = 1u|2u|4u|8u }; constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexcept @@ -40,10 +40,10 @@ constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexc struct PinDescription : public PinDescriptionBase { PinCapability cap; - const char* pinNames; + const char* _ecv_array null pinNames; PinCapability GetCapability() const noexcept { return cap; } - const char* GetNames() const noexcept { return pinNames; } + const char* _ecv_array null GetNames() const noexcept { return pinNames; } }; #endif /* SRC_HARDWARE_SAME5X_PINDESCRIPTION_H_ */ diff --git a/src/Hardware/SAME70/PinDescription.h b/src/Hardware/SAME70/PinDescription.h index 77c80971..1924343e 100644 --- a/src/Hardware/SAME70/PinDescription.h +++ b/src/Hardware/SAME70/PinDescription.h @@ -15,19 +15,19 @@ enum class PinCapability: uint8_t { // Individual capabilities - none = 0, - read = 1, - ain = 2, - write = 4, - pwm = 8, + none = 0u, + read = 1u, + ain = 2u, + write = 4u, + pwm = 8u, // Combinations - ainr = 1|2, - rw = 1|4, - wpwm = 4|8, - rwpwm = 1|4|8, - ainrw = 1|2|4, - ainrwpwm = 1|2|4|8 + ainr = 1u|2u, + rw = 1u|4u, + wpwm = 4u|8u, + rwpwm = 1u|4u|8u, + ainrw = 1u|2u|4u, + ainrwpwm = 1u|2u|4u|8u }; constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexcept @@ -40,10 +40,10 @@ constexpr inline PinCapability operator|(PinCapability a, PinCapability b) noexc struct PinDescription : public PinDescriptionBase { PinCapability cap; - const char* pinNames; + const char *_ecv_array null pinNames; PinCapability GetCapability() const noexcept { return cap; } - const char* GetNames() const noexcept { return pinNames; } + const char *_ecv_array null GetNames() const noexcept { return pinNames; } }; #endif /* SRC_HARDWARE_SAME70_PINDESCRIPTION_H_ */ diff --git a/src/Networking/NetworkDefs.h b/src/Networking/NetworkDefs.h index 1c515f91..116a97ea 100644 --- a/src/Networking/NetworkDefs.h +++ b/src/Networking/NetworkDefs.h @@ -45,7 +45,7 @@ constexpr TcpPort DefaultFtpPort = 21; constexpr TcpPort DefaultTelnetPort = 23; constexpr TcpPort DefaultPortNumbers[NumProtocols] = { DefaultHttpPort, DefaultFtpPort, DefaultTelnetPort }; -constexpr const char * ProtocolNames[NumProtocols] = { "HTTP", "FTP", "TELNET" }; +constexpr const char *_ecv_array ProtocolNames[NumProtocols] = { "HTTP", "FTP", "TELNET" }; constexpr uint8_t MdnsMacAddress[6] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0xFB }; constexpr uint8_t MdnsIPAddress[4] = { 224, 0, 0, 251 }; diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h index a5109050..5a6749e4 100644 --- a/src/ObjectModel/ObjectModel.h +++ b/src/ObjectModel/ObjectModel.h @@ -67,7 +67,7 @@ class ObjectModelArrayDescriptor; // forward declaration // Encapsulated time_t, used to facilitate overloading the ExpressionValue constructor struct DateTime { - DateTime(time_t t) : tim(t) { } + explicit DateTime(time_t t) : tim(t) { } time_t tim; }; @@ -91,8 +91,8 @@ struct ExpressionValue float fVal; int32_t iVal; uint32_t uVal; // used for enumerations, bitmaps and IP addresses (not for integers, we always use int32_t for those) - const char *sVal; - const ObjectModel *omVal; // object of some class derived form ObjectModel + const char *_ecv_array sVal; + const ObjectModel *omVal; // object of some class derived from ObjectModel const ObjectModelArrayDescriptor *omadVal; StringHandle shVal; const IoPort *iopVal; @@ -117,8 +117,8 @@ struct ExpressionValue explicit constexpr ExpressionValue(int32_t i) noexcept : type((uint32_t)TypeCode::Int32), param(0), iVal(i) { } explicit constexpr ExpressionValue(FilePosition p) noexcept : type((uint32_t)TypeCode::Uint32), param(0), uVal(p) { } explicit ExpressionValue(uint64_t u) noexcept : type((uint32_t)TypeCode::Uint64) { Set56BitValue(u); } - explicit constexpr ExpressionValue(const ObjectModel *om) noexcept : type((om == nullptr) ? (uint32_t)TypeCode::None : (uint32_t)TypeCode::ObjectModel_tc), param(0), omVal(om) { } - constexpr ExpressionValue(const ObjectModel *om, uint8_t tableNumber) noexcept : type((om == nullptr) ? (uint32_t)TypeCode::None : (uint32_t)TypeCode::ObjectModel_tc), param(tableNumber), omVal(om) { } + explicit constexpr ExpressionValue(const ObjectModel* null om) noexcept : type((om == nullptr) ? (uint32_t)TypeCode::None : (uint32_t)TypeCode::ObjectModel_tc), param(0), omVal(om) { } + constexpr ExpressionValue(const ObjectModel *null om, uint8_t tableNumber) noexcept : type((om == nullptr) ? (uint32_t)TypeCode::None : (uint32_t)TypeCode::ObjectModel_tc), param(tableNumber), omVal(om) { } explicit constexpr ExpressionValue(const char *s) noexcept : type((uint32_t)TypeCode::CString), param(0), sVal(s) { } explicit constexpr ExpressionValue(const ObjectModelArrayDescriptor *omad) noexcept : type((uint32_t)TypeCode::Array), param(0), omadVal(omad) { } explicit constexpr ExpressionValue(IPAddress ip) noexcept : type((uint32_t)TypeCode::IPAddress_tc), param(0), uVal(ip.GetV4LittleEndian()) { } @@ -140,7 +140,7 @@ struct ExpressionValue explicit ExpressionValue(Bitmap<uint32_t> bm) noexcept : type((uint32_t)TypeCode::Bitmap32), param(0), uVal(bm.GetRaw()) { } explicit ExpressionValue(Bitmap<uint64_t> bm) noexcept : type((uint32_t)TypeCode::Bitmap64) { Set56BitValue(bm.GetRaw()); } explicit ExpressionValue(const MacAddress& mac) noexcept; - explicit ExpressionValue(SpecialType s, uint32_t u) noexcept : type((uint32_t)TypeCode::Special), param((uint32_t)s), uVal(u) { } + ExpressionValue(SpecialType s, uint32_t u) noexcept : type((uint32_t)TypeCode::Special), param((uint32_t)s), uVal(u) { } explicit ExpressionValue(StringHandle h) noexcept : type((uint32_t)TypeCode::HeapString), param(0), shVal(h) { } explicit ExpressionValue(const IoPort& p) noexcept : type((uint32_t)TypeCode::Port), param(0), iopVal(&p) { } explicit ExpressionValue(const UniqueId& id) noexcept : type((uint32_t)TypeCode::UniqueId_tc), param(0), uniqueIdVal(&id) { } @@ -163,7 +163,7 @@ struct ExpressionValue void Set(int32_t i) noexcept { Release(); type = (uint32_t)TypeCode::Int32; iVal = i; } void Set(float f) noexcept { Release(); type = (uint32_t)TypeCode::Float; fVal = f; param = MaxFloatDigitsDisplayedAfterPoint; } void Set(float f, uint32_t digits) noexcept { Release(); type = (uint32_t)TypeCode::Float; fVal = f; param = digits; } - void Set(const char *s) noexcept { Release(); type = (uint32_t)TypeCode::CString; sVal = s; } + void Set(const char *_ecv_array s) noexcept { Release(); type = (uint32_t)TypeCode::CString; sVal = s; } void Set(DriverId did) noexcept { Release(); @@ -180,7 +180,7 @@ struct ExpressionValue void Set(nullptr_t dummy) noexcept { Release(); type = (uint32_t)TypeCode::None; } // Store a 56-bit value - void Set56BitValue(uint64_t v) { Release(); param = (uint32_t)(v >> 32) & 0x00FFFFFF; uVal = (uint32_t)v; } + void Set56BitValue(uint64_t v) { Release(); param = (uint32_t)(v >> 32) & 0x00FFFFFFu; uVal = (uint32_t)v; } // Extract a 56-bit value that we have stored. Used to retrieve date/times and large bitmaps. uint64_t Get56BitValue() const noexcept { return ((uint64_t)param << 32) | uVal; } @@ -194,7 +194,7 @@ struct ExpressionValue #endif // Get the format string to use assuming this is a floating point number - const char *GetFloatFormatString() const noexcept; + const char *_ecv_array GetFloatFormatString() const noexcept; // Append a string representation of this value to a string void AppendAsString(const StringRef& str) const noexcept; @@ -285,7 +285,7 @@ private: class ObjectModelArrayDescriptor { public: - ReadWriteLock *lockPointer; + ReadWriteLock *null lockPointer; size_t (*GetNumElements)(const ObjectModel*, const ObjectExplorationContext&) noexcept; ExpressionValue (*GetElement)(const ObjectModel*, ObjectExplorationContext&) noexcept; }; @@ -347,7 +347,7 @@ private: }; // Function used for compile-time check for the correct number of entries in an object model table -static inline constexpr size_t ArraySum(const uint8_t *arr, size_t numEntries) noexcept +static inline constexpr size_t ArraySum(const uint8_t *_ecv_array arr, size_t numEntries) noexcept { return (numEntries == 0) ? 0 : arr[0] + ArraySum(arr + 1, numEntries - 1); } @@ -363,9 +363,9 @@ public: typedef ExpressionValue(*DataFetchPtr_t)(const ObjectModel*, ObjectExplorationContext&) noexcept; // Member data. This must be public so that we can brace-initialise table entries. - const char * name; // name of this field - DataFetchPtr_t func; // function that yields this value - ObjectModelEntryFlags flags; // information about this value + const char *_ecv_array name; // name of this field + DataFetchPtr_t func; // function that yields this value + ObjectModelEntryFlags flags; // information about this value // Member functions. These must all be 'const'. @@ -379,25 +379,25 @@ public: bool ReportAsJson(OutputBuffer* buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *classDescriptor, const ObjectModel *self, const char* filter, bool first) const noexcept; // Return the name of this field - const char* GetName() const noexcept { return name; } + const char *_ecv_array GetName() const noexcept { return name; } // Compare the name of this field with the filter string that we are trying to match int IdCompare(const char *id) const noexcept; // Return true if a section of the OMT is ordered - static inline constexpr bool IsOrdered(const ObjectModelTableEntry *omt, size_t len) noexcept + static inline constexpr bool IsOrdered(const ObjectModelTableEntry *_ecv_array omt, size_t len) noexcept { return len <= 1 || (strcmp(omt[1].name, omt[0].name) == 1 && IsOrdered(omt + 1, len - 1)); } // Return true if a section of the OMT specified by the descriptor is ordered - static inline constexpr bool IsOrdered(uint8_t sectionsLeft, const uint8_t *descriptorSection, const ObjectModelTableEntry *omt) noexcept + static inline constexpr bool IsOrdered(uint8_t sectionsLeft, const uint8_t *_ecv_array descriptorSection, const ObjectModelTableEntry *_ecv_array omt) noexcept { return sectionsLeft == 0 || (IsOrdered(omt, *descriptorSection) && IsOrdered(sectionsLeft - 1, descriptorSection + 1, omt + *descriptorSection)); } // Return true if the whole OMT is ordered - static inline constexpr bool IsOrdered(const uint8_t *descriptor, const ObjectModelTableEntry *omt) noexcept + static inline constexpr bool IsOrdered(const uint8_t *_ecv_array descriptor, const ObjectModelTableEntry *_ecv_array omt) noexcept { return IsOrdered(descriptor[0], descriptor + 1, omt); } @@ -410,7 +410,7 @@ struct ObjectModelClassDescriptor const ObjectModelClassDescriptor *parent; }; -// Use this macro to inherit form ObjectModel +// Use this macro to inherit from ObjectModel #define INHERIT_OBJECT_MODEL : public ObjectModel // Use this macro in the 'protected' section of every class declaration that derived from ObjectModel diff --git a/src/ObjectModel/Variable.h b/src/ObjectModel/Variable.h index babbf92c..e107faaa 100644 --- a/src/ObjectModel/Variable.h +++ b/src/ObjectModel/Variable.h @@ -18,7 +18,7 @@ class Variable { public: - Variable(const char *str, ExpressionValue pVal, int8_t pScope) noexcept; + Variable(const char *_ecv_array str, ExpressionValue pVal, int8_t pScope) noexcept; ~Variable(); ReadLockedPointer<const char> GetName() const noexcept { return name.Get(); } @@ -44,8 +44,8 @@ public: void AssignFrom(VariableSet& other) noexcept; - Variable *Lookup(const char *str) noexcept; - const Variable *Lookup(const char *str) const noexcept; + Variable *Lookup(const char *_ecv_array str) noexcept; + const Variable *Lookup(const char *_ecv_array str) const noexcept; void InsertNew(const char *str, ExpressionValue pVal, int8_t pScope) noexcept; void EndScope(uint8_t blockNesting) noexcept; void Delete(const char *str) noexcept; @@ -59,13 +59,13 @@ private: void* operator new(size_t sz) noexcept { return FreelistManager::Allocate<LinkedVariable>(); } void operator delete(void* p) noexcept { FreelistManager::Release<LinkedVariable>(p); } - LinkedVariable(const char *str, ExpressionValue pVal, int8_t pScope, LinkedVariable *p_next) : next(p_next), v(str, pVal, pScope) {} + LinkedVariable(const char *_ecv_array str, ExpressionValue pVal, int8_t pScope, LinkedVariable *p_next) : next(p_next), v(str, pVal, pScope) {} - LinkedVariable *next; + LinkedVariable * null next; Variable v; }; - LinkedVariable *root; + LinkedVariable * null root; }; #endif /* SRC_GCODES_VARIABLE_H_ */ diff --git a/src/Platform/Heap.h b/src/Platform/Heap.h index 01458d99..58b449cc 100644 --- a/src/Platform/Heap.h +++ b/src/Platform/Heap.h @@ -25,7 +25,7 @@ class StringHandle { public: StringHandle() noexcept { slotPtr = nullptr; } - StringHandle(const char *s) noexcept; + explicit StringHandle(const char *s) noexcept; StringHandle(const char *s, size_t len) noexcept; #if 0 // unused @@ -55,7 +55,7 @@ protected: static void GarbageCollectInternal() noexcept; static void AdjustHandles(char *startAddr, char *endAddr, size_t moveDown, unsigned int numHandles) noexcept; - IndexSlot *slotPtr; + IndexSlot * null slotPtr; static ReadWriteLock heapLock; static IndexBlock *indexRoot; @@ -73,7 +73,7 @@ class AutoStringHandle : public StringHandle { public: AutoStringHandle() noexcept : StringHandle() { } - AutoStringHandle(const char *s) noexcept : StringHandle(s) { } + explicit AutoStringHandle(const char *s) noexcept : StringHandle(s) { } AutoStringHandle(const char *s, size_t len) noexcept : StringHandle(s, len) { } AutoStringHandle(const AutoStringHandle& other) noexcept; AutoStringHandle(AutoStringHandle&& other) noexcept; diff --git a/src/Platform/MessageType.h b/src/Platform/MessageType.h index 7f82f0f2..70072808 100644 --- a/src/Platform/MessageType.h +++ b/src/Platform/MessageType.h @@ -45,7 +45,7 @@ enum MessageType : uint32_t LogMessageHighBit = 0x80000000u, // Log level consists of two bits this is the high bit // Common combinations - NoDestinationMessage = 0, // A message that is going nowhere + NoDestinationMessage = 0u, // A message that is going nowhere GenericMessage = UsbMessage | AuxMessage | HttpMessage | TelnetMessage, // A message that is to be sent to the web, Telnet, USB and panel LogOff = LogMessageLowBit | LogMessageHighBit, // Log level "off (3): do not log this message LogWarn = LogMessageHighBit, // Log level "warn" (2): all messages of type Error and Warning are logged diff --git a/src/Platform/OutputMemory.h b/src/Platform/OutputMemory.h index b86bb84f..c8a3f59b 100644 --- a/src/Platform/OutputMemory.h +++ b/src/Platform/OutputMemory.h @@ -21,44 +21,44 @@ const size_t OUTPUT_STACK_DEPTH = 4; // Number of OutputBuffer chains that can b class OutputBuffer { public: - OutputBuffer(OutputBuffer *n) noexcept : next(n) { } + explicit OutputBuffer(OutputBuffer *null n) noexcept : next(n) { } OutputBuffer(const OutputBuffer&) = delete; void Append(OutputBuffer *other) noexcept; - OutputBuffer *Next() const noexcept { return next; } + OutputBuffer *null Next() const noexcept { return next; } bool IsReferenced() const noexcept { return isReferenced; } bool HadOverflow() const noexcept { return hadOverflow; } void IncreaseReferences(size_t refs) noexcept; - const char *Data() const noexcept { return data; } - const char *UnreadData() const noexcept { return data + bytesRead; } + const char *_ecv_array Data() const noexcept { return data; } + const char *_ecv_array UnreadData() const noexcept { return data + bytesRead; } size_t DataLength() const noexcept { return dataLength; } // How many bytes have been written to this instance? size_t Length() const noexcept; // How many bytes have been written to the whole chain? char& operator[](size_t index) noexcept; char operator[](size_t index) const noexcept; - const char *Read(size_t len) noexcept; + const char *_ecv_array Read(size_t len) noexcept; void Taken(size_t len) noexcept { bytesRead += len; } size_t BytesLeft() const noexcept { return dataLength - bytesRead; } // How many bytes have not been sent yet? uint32_t WhenQueued() const noexcept { return whenQueued; } void UpdateWhenQueued() noexcept; - size_t vprintf(const char *fmt, va_list vargs) noexcept; - size_t printf(const char *fmt, ...) noexcept __attribute__ ((format (printf, 2, 3))); - size_t vcatf(const char *fmt, va_list vargs) noexcept; - size_t catf(const char *fmt, ...) noexcept __attribute__ ((format (printf, 2, 3))); - size_t lcatf(const char *fmt, ...) noexcept __attribute__ ((format (printf, 2, 3))); + size_t vprintf(const char *_ecv_array fmt, va_list vargs) noexcept; + size_t printf(const char *_ecv_array fmt, ...) noexcept __attribute__ ((format (printf, 2, 3))); + size_t vcatf(const char *_ecv_array fmt, va_list vargs) noexcept; + size_t catf(const char *_ecv_array fmt, ...) noexcept __attribute__ ((format (printf, 2, 3))); + size_t lcatf(const char *_ecv_array fmt, ...) noexcept __attribute__ ((format (printf, 2, 3))); size_t copy(const char c) noexcept; - size_t copy(const char *src) noexcept; - size_t copy(const char *src, size_t len) noexcept; + size_t copy(const char *_ecv_array src) noexcept; + size_t copy(const char *_ecv_array src, size_t len) noexcept; size_t cat(const char c) noexcept; - size_t cat(const char *src) noexcept; - size_t lcat(const char *src) noexcept; - size_t cat(const char *src, size_t len) noexcept; - size_t lcat(const char *src, size_t len) noexcept; + size_t cat(const char *_ecv_array src) noexcept; + size_t lcat(const char *_ecv_array src) noexcept; + size_t cat(const char *_ecv_array src, size_t len) noexcept; + size_t lcat(const char *_ecv_array src, size_t len) noexcept; size_t cat(StringRef &str) noexcept; size_t EncodeChar(char c) noexcept; @@ -96,7 +96,7 @@ public: private: void Clear() noexcept; - OutputBuffer *next; + OutputBuffer *null next; OutputBuffer *last; uint32_t whenQueued; // milliseconds timer when this buffer was filled in diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index a2246047..44473d3e 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -364,7 +364,7 @@ public: time_t GetDateTime() const noexcept { return realTime; } // Retrieves the current RTC datetime bool GetDateTime(tm& rslt) const noexcept { return gmtime_r(&realTime, &rslt) != nullptr && realTime != 0; } // Retrieves the broken-down current RTC datetime and returns true if it's valid - bool SetDateTime(time_t time) noexcept; // Sets the current RTC date and time or returns false on error + bool SetDateTime(time_t t) noexcept; // Sets the current RTC date and time or returns false on error // Communications and data storage void AppendUsbReply(OutputBuffer *buffer) noexcept; @@ -405,9 +405,9 @@ public: bool Delete(const char* folder, const char *filename) const noexcept; #endif - const char* GetWebDir() const noexcept; // Where the html etc files are - const char* GetGCodeDir() const noexcept; // Where the gcodes are - const char* GetMacroDir() const noexcept; // Where the user-defined macros are + const char *_ecv_array GetWebDir() const noexcept; // Where the html etc files are + const char *_ecv_array GetGCodeDir() const noexcept; // Where the gcodes are + const char *_ecv_array GetMacroDir() const noexcept; // Where the user-defined macros are // Functions to work with the system files folder GCodeResult SetSysDir(const char* dir, const StringRef& reply) noexcept; // Set the system files path @@ -422,13 +422,13 @@ public: #endif // Message output (see MessageType for further details) - void Message(MessageType type, const char *message) noexcept; + void Message(MessageType type, const char *_ecv_array message) noexcept; void Message(MessageType type, OutputBuffer *buffer) noexcept; - void MessageF(MessageType type, const char *fmt, ...) noexcept __attribute__ ((format (printf, 3, 4))); - void MessageF(MessageType type, const char *fmt, va_list vargs) noexcept; - void DebugMessage(const char *fmt, va_list vargs) noexcept; + void MessageF(MessageType type, const char *_ecv_array fmt, ...) noexcept __attribute__ ((format (printf, 3, 4))); + void MessageF(MessageType type, const char *_ecv_array fmt, va_list vargs) noexcept; + void DebugMessage(const char *_ecv_array fmt, va_list vargs) noexcept; bool FlushMessages() noexcept; // Flush messages to USB and aux, returning true if there is more to send - void SendAlert(MessageType mt, const char *message, const char *title, int sParam, float tParam, AxesBitmap controls) noexcept; + void SendAlert(MessageType mt, const char *_ecv_array message, const char *_ecv_array title, int sParam, float tParam, AxesBitmap controls) noexcept; void StopLogging() noexcept; // Movement @@ -448,7 +448,7 @@ public: void EmergencyDisableDrivers() noexcept; void SetDriversIdle() noexcept; GCodeResult ConfigureDriverBrakePort(GCodeBuffer& gb, const StringRef& reply, size_t driver) noexcept - pre(drive < GetNumActualDirectDrivers()); + pre(driver < GetNumActualDirectDrivers()); GCodeResult SetMotorCurrent(size_t axisOrExtruder, float current, int code, const StringRef& reply) noexcept; int GetMotorCurrent(size_t axisOrExtruder, int code) const noexcept; void SetIdleCurrentFactor(float f) noexcept; @@ -459,14 +459,14 @@ public: void SetDriverStepTiming(size_t driver, const float microseconds[4]) noexcept; bool GetDriverStepTiming(size_t driver, float microseconds[4]) const noexcept; float DriveStepsPerUnit(size_t axisOrExtruder) const noexcept; - const float *GetDriveStepsPerUnit() const noexcept + const float *_ecv_array GetDriveStepsPerUnit() const noexcept { return driveStepsPerUnit; } void SetDriveStepsPerUnit(size_t axisOrExtruder, float value, uint32_t requestedMicrostepping) noexcept; float Acceleration(size_t axisOrExtruder) const noexcept; - const float* Accelerations() const noexcept; + const float *_ecv_array Accelerations() const noexcept; void SetAcceleration(size_t axisOrExtruder, float value) noexcept; float MaxFeedrate(size_t axisOrExtruder) const noexcept; - const float* MaxFeedrates() const noexcept { return maxFeedrates; } + const float *_ecv_array MaxFeedrates() const noexcept { return maxFeedrates; } void SetMaxFeedrate(size_t axisOrExtruder, float value) noexcept; float MinMovementSpeed() const noexcept { return minimumMovementSpeed; } void SetMinMovementSpeed(float value) noexcept; @@ -499,7 +499,7 @@ public: void SetExtruderDriver(size_t extruder, DriverId driver) noexcept pre(extruder < MaxExtruders); uint32_t GetDriversBitmap(size_t axisOrExtruder) const noexcept // get the bitmap of driver step bits for this axis or extruder - pre(axisOrExtruder < MaxAxesPlusExtruders + NumLocalDrivers) + pre(axisOrExtruder < MaxAxesPlusExtruders + NumDirectDrivers) { return driveDriverBits[axisOrExtruder]; } uint32_t GetSlowDriversBitmap() const noexcept { return slowDriversBitmap; } uint32_t GetSlowDriverStepHighClocks() const noexcept { return slowDriverStepTimingClocks[0]; } @@ -508,7 +508,7 @@ public: uint32_t GetSlowDriverDirHoldClocks() const noexcept { return slowDriverStepTimingClocks[3]; } uint32_t GetSteppingEnabledDrivers() const noexcept { return steppingEnabledDriversBitmap; } void DisableSteppingDriver(uint8_t driver) noexcept { steppingEnabledDriversBitmap &= ~StepPins::CalcDriverBitmap(driver); } - void EnableAllSteppingDrivers() noexcept { steppingEnabledDriversBitmap = 0xFFFFFFFF; } + void EnableAllSteppingDrivers() noexcept { steppingEnabledDriversBitmap = 0xFFFFFFFFu; } #if SUPPORT_NONLINEAR_EXTRUSION bool GetExtrusionCoefficients(size_t extruder, float& a, float& b, float& limit) const noexcept; @@ -616,7 +616,7 @@ public: GCodeResult ConfigurePort(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); GpOutputPort& GetGpOutPort(size_t gpoutPortNumber) noexcept - pre(gpioPortNumber < MaxGpOutPorts) { return gpoutPorts[gpoutPortNumber]; } + pre(gpoutPortNumber < MaxGpOutPorts) { return gpoutPorts[gpoutPortNumber]; } const GpInputPort& GetGpInPort(size_t gpinPortNumber) const noexcept pre(gpinPortNumber < MaxGpInPorts) { return gpinPorts[gpinPortNumber]; } @@ -705,7 +705,7 @@ private: // Drives void UpdateMotorCurrent(size_t driver, float current) noexcept; void SetDriverDirection(uint8_t driver, bool direction) noexcept - pre(driver < DRIVES); + pre(driver < NumDirectDrivers); #if VARIABLE_NUM_DRIVERS && SUPPORT_12864_LCD size_t numActualDirectDrivers; @@ -894,18 +894,18 @@ private: #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES // Where the htm etc files are -inline const char* Platform::GetWebDir() const noexcept +inline const char *_ecv_array Platform::GetWebDir() const noexcept { return WEB_DIR; } // Where the gcodes are -inline const char* Platform::GetGCodeDir() const noexcept +inline const char *_ecv_array Platform::GetGCodeDir() const noexcept { return GCODE_DIR; } -inline const char* Platform::GetMacroDir() const noexcept +inline const char *_ecv_array Platform::GetMacroDir() const noexcept { return MACRO_DIR; } @@ -926,7 +926,7 @@ inline float Platform::Acceleration(size_t drive) const noexcept return accelerations[drive]; } -inline const float* Platform::Accelerations() const noexcept +inline const float *_ecv_array Platform::Accelerations() const noexcept { return accelerations; } diff --git a/src/Platform/Tasks.cpp b/src/Platform/Tasks.cpp index 6cd12a2d..d3388c0b 100644 --- a/src/Platform/Tasks.cpp +++ b/src/Platform/Tasks.cpp @@ -183,7 +183,7 @@ void *Tasks::GetNVMBuffer(const uint32_t *stk) noexcept // If we reset immediately then the user area write doesn't complete and the bits get set to all 1s. delayMicroseconds(10000); - Reset(); + ResetProcessor(); } } } diff --git a/src/RepRapFirmware.cpp b/src/RepRapFirmware.cpp index d91de2e3..7425fa9a 100644 --- a/src/RepRapFirmware.cpp +++ b/src/RepRapFirmware.cpp @@ -172,14 +172,14 @@ Licence: GPL RepRap reprap; // Get the format string to use for printing a floating point number to the specified number of decimal digits. Zero means the maximum sensible number. -const char *GetFloatFormatString(unsigned int numDigitsAfterPoint) noexcept +const char *_ecv_array GetFloatFormatString(unsigned int numDigitsAfterPoint) noexcept { - static constexpr const char *FormatStrings[] = { "%.7f", "%.1f", "%.2f", "%.3f", "%.4f", "%.5f", "%.6f", "%.7f" }; + static constexpr const char *_ecv_array FormatStrings[] = { "%.7f", "%.1f", "%.2f", "%.3f", "%.4f", "%.5f", "%.6f", "%.7f" }; static_assert(ARRAY_SIZE(FormatStrings) == MaxFloatDigitsDisplayedAfterPoint + 1); return FormatStrings[min<unsigned int>(numDigitsAfterPoint, MaxFloatDigitsDisplayedAfterPoint)]; } -static const char * const moduleName[] = +static const char *_ecv_array const moduleName[] = { "Platform", "Network", @@ -204,7 +204,7 @@ static const char * const moduleName[] = static_assert(ARRAY_SIZE(moduleName) == Module::numModules + 1); -const char *GetModuleName(uint8_t module) noexcept +const char *_ecv_array GetModuleName(uint8_t module) noexcept { return (module < ARRAY_SIZE(moduleName)) ? moduleName[module] : "unknown"; } diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h index 0b8a0d25..1387947f 100644 --- a/src/RepRapFirmware.h +++ b/src/RepRapFirmware.h @@ -32,7 +32,7 @@ Licence: GPL #include <ctime> [[deprecated("use gmtime_r instead for thread-safety")]] tm* gmtime(const time_t* t); [[deprecated("use SafeStrptime instead")]] char * strptime (const char *buf, const char *format, struct tm *timeptr); -const char *SafeStrptime(const char *buf, const char *format, struct tm *timeptr) noexcept; +const char *_ecv_array SafeStrptime(const char *_ecv_array buf, const char *_ecv_array format, struct tm *timeptr) noexcept; #include <Core.h> @@ -50,7 +50,7 @@ const char *SafeStrptime(const char *buf, const char *format, struct tm *timeptr # define __nocache // nothing #endif -# include <CoreIO.h> +#include <CoreIO.h> # include <Devices.h> // The following are needed by many other files, so include them here @@ -192,12 +192,12 @@ struct DriverId DriverId() noexcept : localDriver(0) { } // Constructor used by object model - DriverId(uint8_t drv) noexcept : localDriver(drv) { } + explicit DriverId(uint8_t drv) noexcept : localDriver(drv) { } // Set the driver ID from the binary value, returning true if there was a nonzero board number so that the caller knows the address is not valid bool SetFromBinary(uint32_t val) noexcept { - localDriver = val & 0x000000FF; + localDriver = val & 0x000000FFu; const uint32_t brdNum = val >> 16; return (brdNum != 0); } @@ -262,7 +262,7 @@ enum Module : uint8_t noModule = numModules }; -const char *GetModuleName(uint8_t module) noexcept; +const char *_ecv_array GetModuleName(uint8_t module) noexcept; // Warn of what's to come, so we can use pointers and references to classes without including the entire header files class Network; @@ -391,7 +391,7 @@ void ListDrivers(const StringRef& str, DriversBitmap drivers) noexcept; template<class T> class SimpleRangeIterator { public: - SimpleRangeIterator(T value_) noexcept : val(value_) {} + explicit SimpleRangeIterator(T value_) noexcept : val(value_) {} bool operator != (SimpleRangeIterator<T> const& other) const noexcept { return val != other.val; } T const& operator*() const noexcept { return val; } SimpleRangeIterator<T>& operator++() noexcept { ++val; return *this; } @@ -403,7 +403,7 @@ private: template<class T> class SimpleRange { public: - SimpleRange(T limit) noexcept : _end(limit) {} + explicit SimpleRange(T limit) noexcept : _end(limit) {} SimpleRangeIterator<T> begin() const noexcept { return SimpleRangeIterator<T>(0); } SimpleRangeIterator<T> end() const noexcept { return SimpleRangeIterator<T>(_end); } @@ -482,7 +482,7 @@ constexpr float SecondsToMillis = 1000.0; constexpr float MillisToSeconds = 0.001; constexpr float InchToMm = 25.4; constexpr float Pi = 3.141592653589793; -constexpr float TwoPi = 3.141592653589793 * 2; +constexpr float TwoPi = 3.141592653589793 * 2.0; constexpr float DegreesToRadians = 3.141592653589793/180.0; constexpr float RadiansToDegrees = 180.0/3.141592653589793; @@ -503,46 +503,46 @@ constexpr float StepClocksToMillis = 1000.0/(float)StepClockRate; // Functions to convert speeds and accelerations between seconds and step clocks static inline constexpr float ConvertSpeedFromMmPerSec(float speed) noexcept { - return speed * 1.0/StepClockRate; + return speed * 1.0/(float)StepClockRate; } static inline constexpr float ConvertSpeedFromMmPerMin(float speed) noexcept { - return speed * (1.0/(StepClockRate * iMinutesToSeconds)); + return speed * (1.0/(float)(StepClockRate * iMinutesToSeconds)); } static inline constexpr float ConvertSpeedFromMm(float speed, bool useSeconds) noexcept { - return speed * ((useSeconds) ? 1.0/StepClockRate : 1.0/(StepClockRate * iMinutesToSeconds)); + return speed * ((useSeconds) ? 1.0/(float)StepClockRate : 1.0/(float)(StepClockRate * iMinutesToSeconds)); } static inline constexpr float InverseConvertSpeedToMmPerSec(float speed) noexcept { - return speed * StepClockRate; + return speed * (float)StepClockRate; } static inline constexpr float InverseConvertSpeedToMmPerMin(float speed) noexcept { - return speed * (StepClockRate * iMinutesToSeconds); + return speed * (float)(StepClockRate * iMinutesToSeconds); } static inline constexpr float InverseConvertSpeedToMm(float speed, bool useSeconds) noexcept { - return speed * ((useSeconds) ? StepClockRate : StepClockRate * iMinutesToSeconds); + return speed * (float)((useSeconds) ? StepClockRate : StepClockRate * iMinutesToSeconds); } static inline constexpr float ConvertAcceleration(float accel) noexcept { - return accel * (1.0/StepClockRateSquared); + return accel * (1.0/(float)StepClockRateSquared); } static inline constexpr float InverseConvertAcceleration(float accel) noexcept { - return accel * StepClockRateSquared; + return accel * (float)StepClockRateSquared; } constexpr unsigned int MaxFloatDigitsDisplayedAfterPoint = 7; -const char *GetFloatFormatString(unsigned int numDigitsAfterPoint) noexcept; +const char *_ecv_array GetFloatFormatString(unsigned int numDigitsAfterPoint) noexcept; #if SUPPORT_WORKPLACE_COORDINATES constexpr size_t NumCoordinateSystems = 9; // G54 up to G59.3 @@ -559,7 +559,7 @@ const FileHandle noFileHandle = 0; // Type of an offset in a file typedef uint32_t FilePosition; -const FilePosition noFilePosition = 0xFFFFFFFF; +const FilePosition noFilePosition = 0xFFFFFFFFu; //------------------------------------------------------------------------------------------------- // Interrupt priorities - must be chosen with care! 0 is the highest priority, 7 or 15 is the lowest. diff --git a/src/RepRapFirmware.pdp b/src/RepRapFirmware.pdp Binary files differindex 363c53d9..18d7fddb 100644 --- a/src/RepRapFirmware.pdp +++ b/src/RepRapFirmware.pdp diff --git a/src/Storage/FileData.h b/src/Storage/FileData.h index ca2a000f..22f4f6bf 100644 --- a/src/Storage/FileData.h +++ b/src/Storage/FileData.h @@ -26,7 +26,7 @@ public: f = other.f; if (f != nullptr) { - f->Duplicate(); + not_null(f)->Duplicate(); } } @@ -62,7 +62,7 @@ public: { if (f != nullptr) { - bool ok = f->Close(); + bool ok = not_null(f)->Close(); f = nullptr; return ok; } @@ -70,61 +70,72 @@ public: } bool Read(char& b) noexcept + pre(IsLive()) { - return f->Read(b); + return not_null(f)->Read(b); } int Read(char *buf, size_t nBytes) noexcept + pre(IsLive()) { - return f->Read(buf, nBytes); + return not_null(f)->Read(buf, nBytes); } # if HAS_MASS_STORAGE || HAS_SBC_INTERFACE bool Write(char b) noexcept + pre(IsLive()) { - return f->Write(b); + return not_null(f)->Write(b); } - bool Write(const char *s) noexcept + bool Write(const char *_ecv_array s) noexcept + pre(IsLive()) { - return f->Write(s, strlen(s)); + return not_null(f)->Write(s, strlen(s)); } - bool Write(const char *s, size_t len) noexcept + bool Write(const char *_ecv_array s, size_t len) noexcept + pre(IsLive()) { - return f->Write(s, len); + return not_null(f)->Write(s, len); } - bool Write(const uint8_t *s, size_t len) noexcept + bool Write(const uint8_t *_ecv_array s, size_t len) noexcept + pre(IsLive()) { - return f->Write(s, len); + return not_null(f)->Write(s, len); } // This returns the CRC32 of data written to a newly-created file. It does not calculate the CRC of an existing file. uint32_t GetCrc32() const noexcept + pre(IsLive()) { - return f->GetCRC32(); + return not_null(f)->GetCRC32(); } bool Flush() noexcept + pre(IsLive()) { - return f->Flush(); + return not_null(f)->Flush(); } # endif FilePosition GetPosition() const noexcept + pre(IsLive()) { - return f->Position(); + return not_null(f)->Position(); } bool Seek(FilePosition position) noexcept + pre(IsLive()) { - return f->Seek(position); + return not_null(f)->Seek(position); } FilePosition Length() const noexcept + pre(IsLive()) { - return f->Length(); + return not_null(f)->Length(); } // Move operator @@ -142,12 +153,12 @@ public: f = other.f; if (f != nullptr) { - f->Duplicate(); + not_null(f)->Duplicate(); } } private: - FileStore *f; + FileStore * null f; void Init() noexcept { diff --git a/src/Storage/FileInfoParser.h b/src/Storage/FileInfoParser.h index b350de06..8728a4a5 100644 --- a/src/Storage/FileInfoParser.h +++ b/src/Storage/FileInfoParser.h @@ -47,18 +47,18 @@ public: // The following method needs to be called repeatedly until it doesn't return GCodeResult::notFinished - this may take a few runs GCodeResult GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept; - static constexpr const char* SimulatedTimeString = "\n; Simulated print time"; // used by FileInfoParser and MassStorage + static constexpr const char *_ecv_array SimulatedTimeString = "\n; Simulated print time"; // used by FileInfoParser and MassStorage private: // G-Code parser methods - bool FindHeight(const char* bufp, size_t len) noexcept; - bool FindLayerHeight(const char* bufp) noexcept; - bool FindSlicerInfo(const char* bufp) noexcept; - bool FindPrintTime(const char* bufp) noexcept; - bool FindSimulatedTime(const char* bufp) noexcept; - unsigned int FindFilamentUsed(const char* bufp) noexcept; - void FindFilamentUsedEmbedded(const char* p, const char *s1, const char *s2, unsigned int &filamentsFound) noexcept; + bool FindHeight(const char *_ecv_array bufp, size_t len) noexcept; + bool FindLayerHeight(const char *_ecv_array bufp) noexcept; + bool FindSlicerInfo(const char *_ecv_array bufp) noexcept; + bool FindPrintTime(const char *_ecv_array bufp) noexcept; + bool FindSimulatedTime(const char *_ecv_array bufp) noexcept; + unsigned int FindFilamentUsed(const char *_ecv_array bufp) noexcept; + void FindFilamentUsedEmbedded(const char *_ecv_array p, const char *_ecv_array s1, const char *_ecv_array s2, unsigned int &filamentsFound) noexcept; // We parse G-Code files in multiple stages. These variables hold the required information Mutex parserMutex; diff --git a/src/Storage/FileWriteBuffer.h b/src/Storage/FileWriteBuffer.h index 26f05fa4..5f5deb39 100644 --- a/src/Storage/FileWriteBuffer.h +++ b/src/Storage/FileWriteBuffer.h @@ -40,15 +40,15 @@ public: #if SAME70 FileWriteBuffer(FileWriteBuffer *n, char *storage) noexcept : next(n), index(0), buf(storage) { } #else - FileWriteBuffer(FileWriteBuffer *n) noexcept : next(n), index(0) { } + explicit FileWriteBuffer(FileWriteBuffer *n) noexcept : next(n), index(0) { } #endif static void UsingSbcMode() { fileWriteBufLen = SbcFileWriteBufLen; } // only called by RepRap on startup FileWriteBuffer *Next() const noexcept { return next; } void SetNext(FileWriteBuffer *n) noexcept { next = n; } - char *Data() noexcept { return buf; } - const char *Data() const noexcept { return buf; } + char *_ecv_array Data() noexcept { return buf; } + const char *_ecv_array Data() const noexcept { return buf; } const size_t BytesStored() const noexcept { return index; } const size_t BytesLeft() const noexcept { return fileWriteBufLen - index; } @@ -62,7 +62,7 @@ private: size_t index; #if SAME70 - char *buf; + char *_ecv_array buf; #else alignas(4) char buf[FileWriteBufLen]; // 32-bit aligned buffer for better HSMCI performance #endif diff --git a/src/Storage/MassStorage.h b/src/Storage/MassStorage.h index 3753923b..86b0782f 100644 --- a/src/Storage/MassStorage.h +++ b/src/Storage/MassStorage.h @@ -64,30 +64,30 @@ namespace MassStorage #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES bool DirectoryExists(const StringRef& path) noexcept; // Warning: if 'path' has a trailing '/' or '\\' character, it will be removed! - bool DirectoryExists(const char *path) noexcept; + bool DirectoryExists(const char *_ecv_array path) noexcept; unsigned int GetNumFreeFiles() noexcept; bool IsDriveMounted(size_t drive) noexcept; - bool FindFirst(const char *directory, FileInfo &file_info) noexcept; + bool FindFirst(const char *_ecv_array directory, FileInfo &file_info) noexcept; bool FindNext(FileInfo &file_info) noexcept; void AbandonFindNext() noexcept; - GCodeResult GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept; + GCodeResult GetFileInfo(const char *_ecv_array filePath, GCodeFileInfo& info, bool quitEarly) noexcept; GCodeResult Mount(size_t card, const StringRef& reply, bool reportSuccess) noexcept; GCodeResult Unmount(size_t card, const StringRef& reply) noexcept; void Diagnostics(MessageType mtype) noexcept; #endif #if HAS_MASS_STORAGE - bool EnsurePath(const char* filePath, bool messageIfFailed) noexcept; - bool MakeDirectory(const char *directory, bool messageIfFailed) noexcept; - bool Rename(const char *oldFilePath, const char *newFilePath, bool deleteExisting, bool messageIfFailed) noexcept; - time_t GetLastModifiedTime(const char *filePath) noexcept; - bool SetLastModifiedTime(const char *file, time_t time) noexcept; + bool EnsurePath(const char *_ecv_array filePath, bool messageIfFailed) noexcept; + bool MakeDirectory(const char *_ecv_array directory, bool messageIfFailed) noexcept; + bool Rename(const char *_ecv_array oldFilePath, const char *_ecv_array newFilePath, bool deleteExisting, bool messageIfFailed) noexcept; + time_t GetLastModifiedTime(const char *_ecv_array filePath) noexcept; + bool SetLastModifiedTime(const char *_ecv_array file, time_t t) noexcept; bool CheckDriveMounted(const char* path) noexcept; bool IsCardDetected(size_t card) noexcept; unsigned int InvalidateFiles(const FATFS *fs, bool doClose) noexcept; // Invalidate all open files on the specified file system, returning the number of files invalidated bool AnyFileOpen(const FATFS *fs) noexcept; // Return true if any files are open on the file system Mutex& GetVolumeMutex(size_t vol) noexcept; - void RecordSimulationTime(const char *printingFilePath, uint32_t simSeconds) noexcept; // Append the simulated printing time to the end of the file + void RecordSimulationTime(const char *_ecv_array printingFilePath, uint32_t simSeconds) noexcept; // Append the simulated printing time to the end of the file uint16_t GetVolumeSeq(unsigned int volume) noexcept; enum class InfoResult : uint8_t @@ -101,7 +101,7 @@ namespace MassStorage # if SUPPORT_OBJECT_MODEL inline size_t GetNumVolumes() noexcept { return NumSdCards; } - const ObjectModel *GetVolume(size_t vol) noexcept; + const ObjectModel *_ecv_from GetVolume(size_t vol) noexcept; # endif #endif diff --git a/src/bossa/Applet.h b/src/bossa/Applet.h index 60305c6f..28112472 100644 --- a/src/bossa/Applet.h +++ b/src/bossa/Applet.h @@ -37,9 +37,9 @@ class Applet { public: Applet(Samba& samba, - uint32_t addr, + uint32_t p_addr, const uint8_t* code, - uint32_t size, + uint32_t p_size, uint32_t start, uint32_t stack, uint32_t reset) THROWS(GCodeException); diff --git a/src/bossa/BossaFlash.h b/src/bossa/BossaFlash.h index afc03664..99b66a4e 100644 --- a/src/bossa/BossaFlash.h +++ b/src/bossa/BossaFlash.h @@ -64,17 +64,17 @@ class BossaFlash // manuel: required to rename to avoid clash with CoreN2G names { public: BossaFlash(Samba& samba, - const char* name, + const char *_ecv_array p_name, uint32_t addr, // Flash base address uint32_t pages, // Number of pages uint32_t size, // Page size in bytes uint32_t planes, // Number of flash planes - uint32_t lockRegions, // Number of flash lock regions + uint32_t p_lockRegions, // Number of flash lock regions uint32_t user, // Address in SRAM where the applet and buffers will be placed uint32_t stack) THROWS(GCodeException); // Address in SRAM where the applet stack will be placed virtual ~BossaFlash() {} - const char* name() noexcept { return _name; } + const char *_ecv_array name() noexcept { return _name; } virtual uint32_t address() noexcept { return _addr; } virtual uint32_t pageSize() noexcept { return _size; } @@ -119,7 +119,7 @@ public: protected: Samba& _samba; - const char* _name; + const char *_ecv_array _name; uint32_t _addr; uint32_t _pages; uint32_t _size; diff --git a/src/bossa/Device.h b/src/bossa/Device.h index 755cc9df..452e3ae9 100644 --- a/src/bossa/Device.h +++ b/src/bossa/Device.h @@ -76,20 +76,20 @@ public: #endif }; - Device(Samba& samba) noexcept : _samba(samba), _flash(nullptr), _family(FAMILY_NONE) {} + explicit Device(Samba& samba) noexcept : _samba(samba), _flash(nullptr), _family(FAMILY_NONE) {} virtual ~Device() { delete _flash; } void create() THROWS(GCodeException); Family getFamily() noexcept { return _family; } - BossaFlash* getFlash() noexcept { return _flash; } + BossaFlash* null getFlash() noexcept { return _flash; } void reset() THROWS(GCodeException); private: Samba& _samba; - BossaFlash* _flash; + BossaFlash* null _flash; Family _family; #if ORIGINAL_BOSSA_CODE diff --git a/src/bossa/Samba.h b/src/bossa/Samba.h index e9467b43..e404e01e 100644 --- a/src/bossa/Samba.h +++ b/src/bossa/Samba.h @@ -46,14 +46,14 @@ public: Samba() noexcept; virtual ~Samba(); - bool connect(SerialPort* port, int bps = 115200) noexcept; + bool connect(SerialPort *_ecv_from port, int bps = 115200) noexcept; void disconnect() noexcept; void writeWord(uint32_t addr, uint32_t value) THROWS(GCodeException); uint32_t readWord(uint32_t addr) THROWS(GCodeException); - void write(uint32_t addr, const uint8_t* buffer, int size) THROWS(GCodeException); - void read(uint32_t addr, uint8_t* buffer, int size) THROWS(GCodeException); + void write(uint32_t addr, const uint8_t *_ecv_array buffer, int size) THROWS(GCodeException); + void read(uint32_t addr, uint8_t *_ecv_array buffer, int size) THROWS(GCodeException); void go(uint32_t addr) THROWS(GCodeException); @@ -71,7 +71,7 @@ public: bool canChecksumBuffer() noexcept { return _canChecksumBuffer; } uint32_t checksumBufferSize() noexcept { return 4096; } - uint16_t crc16Calc(const uint8_t *data, int len) noexcept; + uint16_t crc16Calc(const uint8_t *_ecv_array data, int len) noexcept; private: bool _canChipErase; @@ -81,12 +81,12 @@ private: #if DEBUG_BOSSA bool _debug; #endif - SerialPort* _port; + SerialPort *_ecv_from _port; bool init() noexcept; - void writeXmodem(const uint8_t* buffer, int size) THROWS(GCodeException); - void readXmodem(uint8_t* buffer, int size) THROWS(GCodeException); + void writeXmodem(const uint8_t *_ecv_array buffer, int size) THROWS(GCodeException); + void readXmodem(uint8_t *_ecv_array buffer, int size) THROWS(GCodeException); }; diff --git a/src/bossa/WordCopyApplet.h b/src/bossa/WordCopyApplet.h index d04c60be..90d6b2f1 100644 --- a/src/bossa/WordCopyApplet.h +++ b/src/bossa/WordCopyApplet.h @@ -35,8 +35,8 @@ class WordCopyApplet : public Applet { public: - WordCopyApplet(Samba& samba, uint32_t addr) THROWS(GCodeException); - virtual ~WordCopyApplet(); + WordCopyApplet(Samba& samba, uint32_t p_addr) THROWS(GCodeException); + ~WordCopyApplet() override; void setDstAddr(uint32_t dstAddr) THROWS(GCodeException); void setSrcAddr(uint32_t srcAddr) THROWS(GCodeException); diff --git a/src/libc/strptime.cpp b/src/libc/strptime.cpp index 9f82940b..a22288c5 100644 --- a/src/libc/strptime.cpp +++ b/src/libc/strptime.cpp @@ -37,6 +37,7 @@ */ #define _GNU_SOURCE +#include <ecv_duet3d.h> #include <stddef.h> #include <stdio.h> #include <time.h> @@ -91,7 +92,7 @@ static int first_day (int year) noexcept #define strtol_l(_b, _s, _n, _l) StrToI32(_b, _s) #define strptime_l(_b, _f, _t, _l) strptime_dc(_b, _f, _t) -const char *SafeStrptime(const char *buf, const char *format, struct tm *timeptr) noexcept +const char *SafeStrptime(const char *_ecv_array buf, const char *_ecv_array format, struct tm *timeptr) noexcept { char c; int ymd = 0; @@ -288,7 +289,7 @@ const char *SafeStrptime(const char *buf, const char *format, struct tm *timeptr return buf; } -extern "C" char * strptime (const char *buf, const char *format, struct tm *timeptr) noexcept +extern "C" char * strptime (const char *_ecv_array buf, const char *_ecv_array format, struct tm *timeptr) noexcept { return const_cast<char *>(SafeStrptime (buf, format, timeptr)); } |