aboutsummaryrefslogtreecommitdiffstats
path: root/source/communication.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2022-05-22 09:54:31 -0400
committerClyne Sullivan <clyne@bitgloo.com>2022-05-22 09:54:31 -0400
commit30cf6ea38bdd58b663f0b6fc56141293ec0a204e (patch)
tree102d448dfb1632c9894f9c793a1c244d9f6220eb /source/communication.cpp
parent1310b7f0f67d80d53f6051dfdc75b5b30173aecb (diff)
dynamic code time measurement
Diffstat (limited to 'source/communication.cpp')
-rw-r--r--source/communication.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/source/communication.cpp b/source/communication.cpp
index b5ee28e..e85828b 100644
--- a/source/communication.cpp
+++ b/source/communication.cpp
@@ -32,7 +32,7 @@ static void setBufferSize(unsigned char *);
static void updateGenerator(unsigned char *);
static void loadAlgorithm(unsigned char *);
static void readStatus(unsigned char *);
-static void startConversionMeasure(unsigned char *);
+static void measureConversion(unsigned char *);
static void startConversion(unsigned char *);
static void stopConversion(unsigned char *);
static void startGenerator(unsigned char *);
@@ -53,7 +53,7 @@ static const std::array<std::pair<char, void (*)(unsigned char *)>, 19> commandT
{'D', updateGenerator},
{'E', loadAlgorithm},
{'I', readStatus},
- {'M', startConversionMeasure},
+ {'M', measureConversion},
{'R', startConversion},
{'S', stopConversion},
{'W', startGenerator},
@@ -159,12 +159,10 @@ void readStatus(unsigned char *)
USBSerial::write(buf, sizeof(buf));
}
-void startConversionMeasure(unsigned char *)
+void measureConversion(unsigned char *)
{
- if (EM.assert(run_status == RunStatus::Idle, Error::NotIdle)) {
- run_status = RunStatus::Running;
- ConversionManager::startMeasured();
- }
+ if (EM.assert(run_status == RunStatus::Running, Error::NotRunning))
+ ConversionManager::startMeasurement();
}
void startConversion(unsigned char *)
@@ -177,7 +175,7 @@ void startConversion(unsigned char *)
void stopConversion(unsigned char *)
{
- if (run_status == RunStatus::Running) {
+ if (EM.assert(run_status == RunStatus::Running, Error::NotRunning)) {
ConversionManager::stop();
run_status = RunStatus::Idle;
}