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:
Diffstat (limited to 'src/Platform')
-rw-r--r--src/Platform/Event.cpp12
-rw-r--r--src/Platform/Event.h5
-rw-r--r--src/Platform/Platform.cpp2
3 files changed, 16 insertions, 3 deletions
diff --git a/src/Platform/Event.cpp b/src/Platform/Event.cpp
index 825caf03..4757bbe8 100644
--- a/src/Platform/Event.cpp
+++ b/src/Platform/Event.cpp
@@ -18,9 +18,19 @@ inline Event::Event(Event *_ecv_null pnext, EventType et, uint16_t p_param, uint
text.vprintf(format, vargs);
}
+// Queue an event, or release it if we have a similar event pending already. Returns true if the event was added, false if it was released.
+/*static*/ bool Event::AddEvent(EventType et, uint16_t p_param, CanAddress p_ba, uint8_t devNum, const char *_ecv_array format, ...) noexcept
+{
+ va_list vargs;
+ va_start(vargs, format);
+ const bool ret = AddEventV(et, p_param, p_ba, devNum, format, vargs);
+ va_end(vargs);
+ return ret;
+}
+
// Queue an event unless we have a similar event pending already. Returns true if the event was added.
// The event list is held in priority order, lowest numbered (highest priority) events first.
-/*static*/ bool Event::AddEvent(EventType et, uint16_t p_param, uint8_t devNum, CanAddress p_ba, const char *_ecv_array format, va_list vargs) noexcept
+/*static*/ bool Event::AddEventV(EventType et, uint16_t p_param, uint8_t devNum, CanAddress p_ba, const char *_ecv_array format, va_list vargs) noexcept
{
// Search for similar events already pending or being processed.
// An event is 'similar' if it has the same type, device number and parameter even if the text is different.
diff --git a/src/Platform/Event.h b/src/Platform/Event.h
index 3f10b4af..edeb12b2 100644
--- a/src/Platform/Event.h
+++ b/src/Platform/Event.h
@@ -43,7 +43,10 @@ public:
static MessageType GetTextDescription(const StringRef& str) noexcept;
// Queue an event, or release it if we have a similar event pending already. Returns true if the event was added, false if it was released.
- static bool AddEvent(EventType et, uint16_t p_param, CanAddress p_ba, uint8_t devNum, const char *_ecv_array format, va_list vargs) noexcept;
+ static bool AddEvent(EventType et, uint16_t p_param, CanAddress p_ba, uint8_t devNum, const char *_ecv_array format, ...) noexcept;
+
+ // Queue an event, or release it if we have a similar event pending already. Returns true if the event was added, false if it was released.
+ static bool AddEventV(EventType et, uint16_t p_param, CanAddress p_ba, uint8_t devNum, const char *_ecv_array format, va_list vargs) noexcept;
// Get the highest priority event if there is one start processing it
static bool StartProcessing() noexcept;
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp
index 7e32200b..cda05c8e 100644
--- a/src/Platform/Platform.cpp
+++ b/src/Platform/Platform.cpp
@@ -1162,7 +1162,7 @@ void Platform::Spin() noexcept
# endif
if (eventOnStallDrivers.Intersects(mask))
{
- Event::AddEvent(EventType::driver_stall, 0, CanInterface::GetCanAddress(), nextDriveToPoll, "", va_list());
+ Event::AddEvent(EventType::driver_stall, 0, CanInterface::GetCanAddress(), nextDriveToPoll, "");
}
else if (logOnStallDrivers.Intersects(mask))
{