Skip to content

Commit 128e0f1

Browse files
committed
Try to teleplot tasks chrono time (but failed because of vnprintf...)
1 parent 74c61f7 commit 128e0f1

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

include/Structure_Helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ struct Chrono
418418
String name = "";
419419
int32_t loopNbr = 0;
420420
static inline bool print = false;
421+
static inline bool teleplot = false;
421422
int32_t loopMax = 0;
422423
unsigned long startTime = 0;
423424
unsigned long elapsedTime = 0;

src/ESP32_Helper.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,26 @@ namespace ESP32_Helper
153153
if (cmdTmp.data[0] == 1)
154154
{
155155
Chrono::print = true;
156-
println("Enable Chrono Print");
156+
Chrono::teleplot = false;
157+
println("Enable Chrono Print, Disable Teleplot");
158+
}
159+
else if (cmdTmp.data[0] == 2)
160+
{
161+
Chrono::print = false;
162+
Chrono::teleplot = true;
163+
println("Disable Chrono Print, Enable Teleplot");
164+
}
165+
else if (cmdTmp.data[0] == 3)
166+
{
167+
Chrono::print = true;
168+
Chrono::teleplot = true;
169+
println("Enable Chrono Print & Teleplot");
157170
}
158171
else
159172
{
160173
Chrono::print = false;
161-
println("Disable Chrono Print");
174+
Chrono::teleplot = false;
175+
println("Disable Chrono Print & Teleplot");
162176
}
163177
}
164178
else if (cmdTmp.cmd.startsWith("SPIFFS"))

src/Printer.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,15 @@ Format Specifier
229229

230230
void printChrono(Chrono chrono)
231231
{
232-
println("Chrono ["+chrono.name+"]: " + String(chrono.elapsedTime) + " µs");
232+
if(Chrono::print)
233+
{
234+
String name = "Chrono["+chrono.name+"]";
235+
int time = (int)(chrono.elapsedTime/chrono.loopNbr);
236+
if(Chrono::print)
237+
println("Chrono [%s]: %d µs", chrono.name.c_str(), time);
238+
}
239+
//if(Chrono::teleplot)
240+
// teleplot(name,time);
233241
}
234242

235243
void teleplot(const String &varName, float var)

0 commit comments

Comments
 (0)