Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/3.6-dev' into v3.6-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gloomyandy committed Sep 23, 2024
2 parents ef6b498 + 632cc2e commit 57f96c2
Show file tree
Hide file tree
Showing 57 changed files with 298 additions and 313 deletions.
8 changes: 4 additions & 4 deletions src/Accelerometers/LISAccelerometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ bool LISAccelerometer::CheckPresent() noexcept
}

// Return the type name of the accelerometer. Only valid after checkPresent returns true.
const char *LISAccelerometer::GetTypeName() const noexcept
const char *_ecv_array LISAccelerometer::GetTypeName() const noexcept
{
return accelerometerType.ToString();
}

uint8_t LISAccelerometer::ReadStatus() noexcept
{
uint8_t val;
return (ReadRegister(LisRegister::Status, val)) ? val : 0xFF;
return (ReadRegister(LisRegister::Status, val)) ? val : 0xFFu;
}

// Configure the accelerometer to collect for the requested axis at or near the requested sampling rate and the requested resolution in bits.
Expand Down Expand Up @@ -347,7 +347,7 @@ bool LISAccelerometer::ReadRegisters(LisRegister reg, size_t numToRead) noexcept
// On the LIS3DH, bit 6 must be set to 1 to auto-increment the address when doing reading multiple registers
// On the LIS3DSH and LIS2DW, bit 6 is an extra register address bit, so we must not set it.
// So that we can read the WHO_AM_I register of both chips before we know which chip we have, only set bit 6 if we have a LIS3DH and we are reading multiple registers.
transferBuffer[1] = (uint8_t)reg | ((numToRead < 2 || accelerometerType != AccelerometerType::LIS3DH) ? 0x80 : 0xC0);
transferBuffer[1] = (uint8_t)reg | ((numToRead < 2 || accelerometerType != AccelerometerType::LIS3DH) ? 0x80u : 0xC0u);
const bool ret = TransceivePacket(transferBuffer + 1, transferBuffer + 1, 1 + numToRead);
Deselect();
return ret;
Expand All @@ -364,7 +364,7 @@ bool LISAccelerometer::WriteRegisters(LisRegister reg, size_t numToWrite) noexce
{
return false;
}
transferBuffer[1] = (numToWrite < 2 || accelerometerType != AccelerometerType::LIS3DH) ? (uint8_t)reg : (uint8_t)reg | 0x40; // set auto increment bit if LIS3DH
transferBuffer[1] = (numToWrite < 2 || accelerometerType != AccelerometerType::LIS3DH) ? (uint8_t)reg : (uint8_t)reg | 0x40u; // set auto increment bit if LIS3DH
const bool ret = TransceivePacket(transferBuffer + 1, transferBuffer + 1, 1 + numToWrite);
Deselect();
return ret;
Expand Down
4 changes: 2 additions & 2 deletions src/Accelerometers/LISAccelerometer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LISAccelerometer : public SharedSpiClient
bool CheckPresent() noexcept;

// Return the type name of the accelerometer. Only valid after checkPresent returns true.
const char *GetTypeName() const noexcept;
const char *_ecv_array GetTypeName() const noexcept;

// Configure the accelerometer to collect at or near the requested sampling rate and the requested resolution in bits.
bool Configure(uint16_t& p_samplingRate, uint8_t& p_resolution) noexcept;
Expand Down Expand Up @@ -64,7 +64,7 @@ class LISAccelerometer : public SharedSpiClient
bool ReadRegister(LisRegister reg, uint8_t& val) noexcept;
bool WriteRegister(LisRegister reg, uint8_t val) noexcept;

volatile TaskHandle taskWaiting;
volatile TaskHandle _ecv_null taskWaiting;
uint32_t firstInterruptTime;
uint32_t lastInterruptTime;
uint32_t totalNumRead;
Expand Down
12 changes: 6 additions & 6 deletions src/Comms/AuxDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void AuxDevice::Disable() noexcept
}
}

void AuxDevice::SendPanelDueMessage(const char* msg) noexcept
void AuxDevice::SendPanelDueMessage(const char *_ecv_array msg) noexcept
{
if (mode == AuxMode::panelDue)
{
Expand All @@ -72,7 +72,7 @@ void AuxDevice::SendPanelDueMessage(const char* msg) noexcept
}
}

void AuxDevice::AppendAuxReply(const char *msg, bool rawMessage) noexcept
void AuxDevice::AppendAuxReply(const char *_ecv_array msg, bool rawMessage) noexcept
{
// Discard this response if either no aux device is attached or if the response is empty
if (msg[0] != 0 && IsEnabledForGCodeIo())
Expand All @@ -95,7 +95,7 @@ void AuxDevice::AppendAuxReply(const char *msg, bool rawMessage) noexcept
}
}

void AuxDevice::AppendAuxReply(OutputBuffer *reply, bool rawMessage) noexcept
void AuxDevice::AppendAuxReply(OutputBuffer *_ecv_array reply, bool rawMessage) noexcept
{
// Discard this response if either no aux device is attached or if the response is empty
if (reply == nullptr || reply->Length() == 0 || !IsEnabledForGCodeIo())
Expand Down Expand Up @@ -134,7 +134,7 @@ bool AuxDevice::Flush() noexcept
if (hasMore)
{
MutexLocker lock(mutex);
OutputBuffer *auxOutputBuffer = outStack.GetFirstItem();
OutputBuffer *_ecv_null auxOutputBuffer = outStack.GetFirstItem();
if (auxOutputBuffer == nullptr)
{
(void)outStack.Pop();
Expand Down Expand Up @@ -447,7 +447,7 @@ uint32_t AuxDevice::CalcTransmissionTime(unsigned int numChars) const noexcept
}

// Send some data to the Uart. Returns GCodeResult::error if we failed to acquire the mutex, GCodeResult::ok if we sent the data.
GCodeResult AuxDevice::SendUartData(const uint8_t *data, size_t len) noexcept
GCodeResult AuxDevice::SendUartData(const uint8_t *_ecv_array data, size_t len) noexcept
{
if (!mutex.Take(BusAvailableTimeout))
{
Expand All @@ -474,7 +474,7 @@ GCodeResult AuxDevice::SendUartData(const uint8_t *data, size_t len) noexcept
return GCodeResult::ok;
}

GCodeResult AuxDevice::ReadUartData(uint8_t *data, size_t bytesToRead) noexcept
GCodeResult AuxDevice::ReadUartData(uint8_t *_ecv_array data, size_t bytesToRead) noexcept
{
if (!mutex.Take(BusAvailableTimeout))
{
Expand Down
20 changes: 10 additions & 10 deletions src/Comms/AuxDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@ class AuxDevice
uint32_t GetBaudRate() const noexcept { return baudRate; }
bool IsRaw() const noexcept { return mode == AuxMode::raw; }

void SendPanelDueMessage(const char* msg) noexcept;
void AppendAuxReply(const char *msg, bool rawMessage) noexcept;
void AppendAuxReply(OutputBuffer *reply, bool rawMessage) noexcept;
void SendPanelDueMessage(const char *_ecv_array msg) noexcept;
void AppendAuxReply(const char *_ecv_array msg, bool rawMessage) noexcept;
void AppendAuxReply(OutputBuffer *_ecv_array reply, bool rawMessage) noexcept;
bool Flush() noexcept;

void Diagnostics(MessageType mt, unsigned int index) noexcept;

#if SUPPORT_MODBUS_RTU
bool ConfigureDirectionPort(const char *pinName, const StringRef& reply) THROWS(GCodeException);
bool ConfigureDirectionPort(const char *_ecv_array pinName, const StringRef& reply) THROWS(GCodeException);
void AppendDirectionPortName(const StringRef& reply) const noexcept;

GCodeResult SendModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, const uint8_t *data) noexcept;
GCodeResult ReadModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, uint8_t *data) noexcept
GCodeResult SendModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, const uint8_t *_ecv_array data) noexcept;
GCodeResult ReadModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, uint8_t *_ecv_array data) noexcept
pre(function == 3 || function == 4);
GCodeResult CheckModbusResult() noexcept;

void TxEndedCallback() noexcept;
#endif

GCodeResult SendUartData(const uint8_t *data, size_t len) noexcept;
GCodeResult ReadUartData(uint8_t *data, size_t bytesToRead) noexcept;
GCodeResult SendUartData(const uint8_t *_ecv_array data, size_t len) noexcept;
GCodeResult ReadUartData(uint8_t *_ecv_array data, size_t bytesToRead) noexcept;

private:
uint32_t CalcTransmissionTime(unsigned int numChars) const noexcept; // calculate the time in milliseconds to send or received the specified number of characters
Expand All @@ -83,7 +83,7 @@ class AuxDevice
static constexpr uint32_t BusAvailableTimeout = 50; // how many milliseconds we wait for the device to become available
static constexpr uint32_t UartResponseTimeout = 200; // how many milliseconds we wait for the device to respond, excluding transmission time

AsyncSerial *uart; // the underlying serial device
AsyncSerial *_ecv_null uart; // the underlying serial device
Mutex mutex;
volatile OutputStack outStack; // output stack for use in raw or PanelDue mode
uint32_t seq; // sequence number for output in PanelDue mode
Expand All @@ -92,7 +92,7 @@ class AuxDevice

#if SUPPORT_MODBUS_RTU
IoPort txNotRx; // port used to switch the RS485 port between transmit and receive
uint8_t *receivedData;
uint8_t *_ecv_array receivedData;
uint32_t whenStartedTransmitting;
CRC16 crc;
uint16_t bytesTransmitted;
Expand Down
3 changes: 3 additions & 0 deletions src/Config/Pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,7 @@
# error Cannot support Modbus RTU without aux devices
#endif

// Function to look up a pin name pass back the corresponding index into the pin table
bool LookupPinName(const char *_ecv_array pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

#endif // PINS_H__
3 changes: 0 additions & 3 deletions src/Config/Pins_Duet3Mini.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ constexpr Pin CanTxPin = PortBPin(14);
constexpr Pin CanRxPin = PortBPin(15);
constexpr GpioPinFunction CanPinsMode = GpioPinFunction::H;

// Function to look up a pin name and pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

// List of assignable pins and their mapping from names to MPU ports. This is indexed by logical pin number.
// The names must match user input that has been concerted to lowercase and had _ and - characters stripped out.
// Aliases are separate by the , character.
Expand Down
3 changes: 0 additions & 3 deletions src/Config/Pins_Duet3_MB6HC.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,6 @@ constexpr PinDescription PinTable[] =
constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable);
static_assert(NumNamedPins == 32+32+32+32+6);

// Function to look up a pin name pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

// Serial Interfaces
constexpr Pin APIN_Serial0_RXD = PortDPin(25);
constexpr Pin APIN_Serial0_TXD = PortDPin(26);
Expand Down
3 changes: 0 additions & 3 deletions src/Config/Pins_Duet3_MB6XD.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,6 @@ constexpr PinDescription PinTable[] =
constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable);
static_assert(NumNamedPins == 32+32+32+32+6);

// Function to look up a pin name pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

// Serial Interfaces
constexpr Pin APIN_Serial0_RXD = PortDPin(25);
constexpr Pin APIN_Serial0_TXD = PortDPin(26);
Expand Down
3 changes: 0 additions & 3 deletions src/Config/Pins_DuetM.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,6 @@ constexpr PinDescription PinTable[] =
constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable);
static_assert(NumNamedPins == 3*32);

// Function to look up a pin name and pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

// Wire Interfaces
#define WIRE_INTERFACES_COUNT (1) // SAM4S supports two I2C interfaces but we only have the first one available

Expand Down
3 changes: 0 additions & 3 deletions src/Config/Pins_DuetNG.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,6 @@ constexpr PinDescription PinTable[] =
constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable);
static_assert(NumNamedPins == 32+32+32+32+6+16+16);

// Function to look up a pin name pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

// USARTs used for SPI
constexpr Pin APIN_USART_SSPI_MOSI = PortBPin(1);
constexpr GpioPinFunction USARTSPIMosiPeriphMode = GpioPinFunction::C;
Expand Down
3 changes: 0 additions & 3 deletions src/Config/Pins_FMDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,6 @@ constexpr Pin EspDataReadyPin = PortAPin(18);
constexpr Pin SamTfrReadyPin = PortAPin(19);
constexpr Pin SamCsPin = PortAPin(14);

// Function to look up a pin name and pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;

// List of assignable pins and their mapping from names to MPU ports. This is indexed by logical pin number.
// The names must match user input that has been concerted to lowercase and had _ and - characters stripped out.
// Aliases are separate by the , character.
Expand Down
2 changes: 0 additions & 2 deletions src/Config/Pins_Pccb.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ constexpr PinDescription PinTable[] =
constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable);
static_assert(NumNamedPins == 3*32);

// Function to look up a pin name pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;
// Wire Interfaces
#define WIRE_INTERFACES_COUNT (1) // SAM4S supports two I2C interfaces but we only have the first one available

Expand Down
12 changes: 6 additions & 6 deletions src/FilamentMonitors/FilamentMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class FilamentMonitor INHERIT_OBJECT_MODEL
{
public:
// Override the virtual destructor if your derived class allocates any dynamic memory
virtual ~FilamentMonitor() noexcept;
virtual ~FilamentMonitor() noexcept override;

// We don't want to copy filament monitors
FilamentMonitor(const FilamentMonitor&) = delete;
FilamentMonitor(const FilamentMonitor &_ecv_from) = delete;

// Static initialisation
static void InitStatic() noexcept;
Expand All @@ -59,7 +59,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL
static size_t GetNumMonitorsToReport() noexcept;

// Get access to a filament monitor when we already have a read lock
static FilamentMonitor *GetMonitorAlreadyLocked(size_t extruder) noexcept { return filamentSensors[extruder]; }
static FilamentMonitor *_ecv_from GetMonitorAlreadyLocked(size_t extruder) noexcept { return filamentSensors[extruder]; }
#endif

#if SUPPORT_CAN_EXPANSION
Expand Down Expand Up @@ -119,7 +119,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL
uint8_t GetDriver() const noexcept { return driveNumber; }

// Get the status of the filament monitor as a string
const char *GetStatusText() const noexcept { return lastStatus.ToString(); }
const char *_ecv_array GetStatusText() const noexcept { return lastStatus.ToString(); }

// Call the following at intervals to check the status. This is only called when extrusion is in progress or imminent.
// 'filamentConsumed' is the net amount of extrusion since the last call to this function.
Expand Down Expand Up @@ -163,7 +163,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL

private:
// Create a filament sensor returning null if not a valid sensor type
static FilamentMonitor *Create(unsigned int extruder, unsigned int monitorType, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException);
static FilamentMonitor *_ecv_from Create(unsigned int extruder, unsigned int monitorType, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException);
static void InterruptEntry(CallbackParameter param) noexcept;

static constexpr size_t NumFilamentMonitors =
Expand All @@ -174,7 +174,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL
MaxExtruders;
#endif

static FilamentMonitor *filamentSensors[NumFilamentMonitors];
static FilamentMonitor *_ecv_from filamentSensors[NumFilamentMonitors];

#if SUPPORT_REMOTE_COMMANDS
static constexpr uint32_t StatusUpdateInterval = 2000; // how often we send status reports when there isn't a change
Expand Down
3 changes: 1 addition & 2 deletions src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ constexpr ObjectModelTableEntry RotatingMagnetFilamentMonitor::objectModelTable[
{ "configured", OBJECT_MODEL_FUNC(self, 2), ObjectModelEntryFlags::none },
#ifdef DUET3_ATE
{ "mag", OBJECT_MODEL_FUNC((int32_t)self->magnitude), ObjectModelEntryFlags::live },
{ "position", OBJECT_MODEL_FUNC((int32_t)self->lastKnownPosition), ObjectModelEntryFlags::live },
#endif

// 1. RotatingMagnetFilamentMonitor.calibrated members
Expand All @@ -66,7 +65,7 @@ constexpr uint8_t RotatingMagnetFilamentMonitor::objectModelTableDescriptor[] =
{
3,
#ifdef DUET3_ATE
5,
4,
#else
2,
#endif
Expand Down
20 changes: 10 additions & 10 deletions src/GCodes/GCodeBuffer/ExpressionParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LineReader
class ExpressionParser
{
public:
ExpressionParser(const GCodeBuffer& p_gb, const char *text, const char *textLimit, int p_column = -1) noexcept;
ExpressionParser(const GCodeBuffer& p_gb, const char *_ecv_array text, const char *_ecv_array textLimit, int p_column = -1) noexcept;

ExpressionValue Parse(bool evaluate = true) THROWS(GCodeException);
bool ParseBoolean() THROWS(GCodeException);
Expand All @@ -64,23 +64,23 @@ class ExpressionParser
const char *GetEndptr() const noexcept { return currentp; }

private:
[[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *str) const THROWS(GCodeException);
[[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *str, const char *param) const THROWS(GCodeException);
[[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *str, uint32_t param) const THROWS(GCodeException);
[[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *_ecv_array str) const THROWS(GCodeException);
[[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *_ecv_array str, const char *param) const THROWS(GCodeException);
[[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *_ecv_array str, uint32_t param) const THROWS(GCodeException);

void __attribute__((noinline)) ParseInternal(ExpressionValue& val, bool evaluate, uint8_t priority) THROWS(GCodeException);
void __attribute__((noinline)) ParseExpectKet(ExpressionValue& rslt, bool evaluate, char expectedKet) THROWS(GCodeException);
void __attribute__((noinline)) ParseNumber(ExpressionValue& rslt) noexcept
pre(readPointer >= 0; isdigit(gb.buffer[readPointer]));
pre((bool)isdigit(*currentp));
void __attribute__((noinline)) ParseIdentifierExpression(ExpressionValue& rslt, bool evaluate, bool applyLengthOperator, bool applyExists) THROWS(GCodeException)
pre(readPointer >= 0; isalpha(gb.buffer[readPointer]));
pre((bool)isalpha(*currentp));
void __attribute__((noinline)) ParseQuotedString(ExpressionValue& rslt) THROWS(GCodeException);

void ParseCharacter(ExpressionValue& rslt) THROWS(GCodeException);
void ParseGeneralArray(ExpressionValue& firstElementAndResult, bool evaluate) THROWS(GCodeException);
void ParseArray(size_t& length, function_ref<void(ExpressionValue& ev, size_t index) THROWS(GCodeException)> processElement) THROWS(GCodeException);

time_t __attribute__((noinline)) ParseDateTime(const char *s) const THROWS(GCodeException);
time_t __attribute__((noinline)) ParseDateTime(const char *_ecv_array s) const THROWS(GCodeException);

void __attribute__((noinline)) GetVariableValue(ExpressionValue& rslt, const VariableSet *vars, const char *name, ObjectExplorationContext& context, bool isParameter, bool applyLengthOperator, bool wantExists) THROWS(GCodeException);

Expand Down Expand Up @@ -115,9 +115,9 @@ class ExpressionParser
void AdvancePointer() noexcept;
char SkipWhiteSpace() noexcept;

const char *currentp;
const char * const startp;
const char * const endp;
const char *_ecv_array currentp;
const char *_ecv_array const startp;
const char *_ecv_array const endp;
const GCodeBuffer& gb;
int column;
String<MaxVariableNameLength> obsoleteField;
Expand Down
Loading

0 comments on commit 57f96c2

Please sign in to comment.