mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-15 12:04:00 +08:00
Squashed 'panda/' content from commit ae816c104
git-subtree-dir: panda git-subtree-split: ae816c104a99a8cd4d508ccd6abdc7b93053529c
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "stdafx.h"
|
||||
#include "MessagePeriodic.h"
|
||||
#include "J2534Connection.h"
|
||||
|
||||
MessagePeriodic::MessagePeriodic(
|
||||
std::chrono::microseconds delay,
|
||||
std::shared_ptr<MessageTx> msg
|
||||
) : Action(msg->connection, delay), msg(msg), runyet(FALSE), active(TRUE) { };
|
||||
|
||||
void MessagePeriodic::execute() {
|
||||
if (!this->active) return;
|
||||
if (this->runyet) {
|
||||
if (msg->isFinished()) {
|
||||
msg->reset();
|
||||
msg->execute();
|
||||
}
|
||||
} else {
|
||||
this->runyet = TRUE;
|
||||
msg->execute();
|
||||
}
|
||||
|
||||
if (auto conn_sp = this->connection.lock()) {
|
||||
if (auto panda_dev_sp = conn_sp->getPandaDev()) {
|
||||
//Scheduling must be relative to now incase there was a long stall that
|
||||
//would case it to be super far behind and try to catch up forever.
|
||||
this->scheduleImmediateDelay();
|
||||
panda_dev_sp->insertActionIntoTaskList(shared_from_this());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user