auto-sync
This commit is contained in:
parent
87695f5acd
commit
2c698a9912
|
@ -56,8 +56,7 @@ typedef char log_buf_t[DL_OUTPUT_BUFFER];
|
|||
|
||||
static log_buf_t pendingBuffers0 CCM_OPTIONAL
|
||||
;
|
||||
static log_buf_t pendingBuffers1
|
||||
;
|
||||
static log_buf_t pendingBuffers1;
|
||||
|
||||
/**
|
||||
* This is the buffer into which all the data providers write
|
||||
|
@ -104,7 +103,7 @@ void append(Logging *logging, const char *text) {
|
|||
return;
|
||||
}
|
||||
strcpy(logging->linePointer, text);
|
||||
/**
|
||||
/**
|
||||
* And now we are pointing at the zero char at the end of the buffer again
|
||||
*/
|
||||
logging->linePointer += extraLen;
|
||||
|
@ -121,8 +120,16 @@ void appendFast(Logging *logging, const char *text) {
|
|||
// c = *s++;
|
||||
// *logging->linePointer++ = c;
|
||||
// } while (c != '\0');
|
||||
int extraLen = efiStrlen(text);
|
||||
strcpy(logging->linePointer, text);
|
||||
register char *s;
|
||||
for (s = (char *) text; *s; ++s)
|
||||
;
|
||||
int extraLen = (s - text);
|
||||
|
||||
s = logging->linePointer;
|
||||
while ((*s++ = *text++) != 0)
|
||||
;
|
||||
|
||||
// strcpy(logging->linePointer, text);
|
||||
logging->linePointer += extraLen;
|
||||
}
|
||||
|
||||
|
@ -195,28 +202,28 @@ char* getCaption(LoggingPoints loggingPoint) {
|
|||
}
|
||||
|
||||
/*
|
||||
// todo: this method does not really belong to this file
|
||||
static char* get2ndCaption(int loggingPoint) {
|
||||
switch (loggingPoint) {
|
||||
case LP_RPM:
|
||||
return "RPM";
|
||||
case LP_THROTTLE:
|
||||
return "%";
|
||||
case LP_IAT:
|
||||
return "°F";
|
||||
case LP_ECT:
|
||||
return "°F";
|
||||
case LP_SECONDS:
|
||||
return "s";
|
||||
case LP_MAP:
|
||||
return "MAP";
|
||||
case LP_MAF:
|
||||
return "MAF";
|
||||
}
|
||||
firmwareError("No such loggingPoint");
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
// todo: this method does not really belong to this file
|
||||
static char* get2ndCaption(int loggingPoint) {
|
||||
switch (loggingPoint) {
|
||||
case LP_RPM:
|
||||
return "RPM";
|
||||
case LP_THROTTLE:
|
||||
return "%";
|
||||
case LP_IAT:
|
||||
return "°F";
|
||||
case LP_ECT:
|
||||
return "°F";
|
||||
case LP_SECONDS:
|
||||
return "s";
|
||||
case LP_MAP:
|
||||
return "MAP";
|
||||
case LP_MAF:
|
||||
return "MAF";
|
||||
}
|
||||
firmwareError("No such loggingPoint");
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
void initLoggingExt(Logging *logging, const char *name, char *buffer, int bufferSize) {
|
||||
print("Init logging %s\r\n", name);
|
||||
|
@ -341,7 +348,7 @@ void resetLogging(Logging *logging) {
|
|||
* This method should only be invoked on main thread because only the main thread can write to the console
|
||||
*/
|
||||
void printMsg(Logging *logger, const char *fmt, ...) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#5o");
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#5o");
|
||||
// resetLogging(logging); // I guess 'reset' is not needed here?
|
||||
appendMsgPrefix(logger);
|
||||
|
||||
|
@ -396,7 +403,7 @@ void scheduleLogging(Logging *logging) {
|
|||
return;
|
||||
}
|
||||
strcpy(accumulationBuffer + accumulatedSize, logging->buffer);
|
||||
accumulatedSize += newLength;
|
||||
accumulatedSize += newLength;
|
||||
if (!alreadyLocked) {
|
||||
unlockOutputBuffer();
|
||||
}
|
||||
|
|
|
@ -96,11 +96,16 @@ void appendPrintf(Logging *logging, const char *fmt, ...);
|
|||
void vappendPrintf(Logging *logging, const char *fmt, va_list arg);
|
||||
void append(Logging *logging, const char *text);
|
||||
void appendFast(Logging *logging, const char *text);
|
||||
|
||||
/**
|
||||
* This macro breaks the normal zero=termination constraint, please take care of this outside of this macro
|
||||
*/
|
||||
#define appendChar(logging, symbol) {(logging)->linePointer[0] = (symbol);(logging)->linePointer++;}
|
||||
|
||||
/**
|
||||
* this method copies the line into the intermediate buffer for later output by
|
||||
* the main thread
|
||||
*/
|
||||
|
||||
void scheduleLogging(Logging *logging);
|
||||
|
||||
void scheduleIntValue(Logging *logging, const char *msg, int value);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "eficonsole.h"
|
||||
#include "status_loop.h"
|
||||
|
||||
#define CHART_DELIMETER "!"
|
||||
#define CHART_DELIMETER '!'
|
||||
|
||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
||||
#include "rfiutil.h"
|
||||
|
@ -187,14 +187,15 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
|
|||
* printf is a heavy method, append is used here as a performance optimization
|
||||
*/
|
||||
appendFast(&logging, name);
|
||||
appendFast(&logging, CHART_DELIMETER);
|
||||
appendChar(&logging, CHART_DELIMETER);
|
||||
appendFast(&logging, msg);
|
||||
appendFast(&logging, CHART_DELIMETER);
|
||||
appendChar(&logging, CHART_DELIMETER);
|
||||
// time100 -= startTime100;
|
||||
|
||||
itoa10(timeBuffer, time100);
|
||||
appendFast(&logging, timeBuffer);
|
||||
appendFast(&logging, CHART_DELIMETER);
|
||||
appendChar(&logging, CHART_DELIMETER);
|
||||
logging.linePointer[0] = 0;
|
||||
}
|
||||
if (!alreadyLocked) {
|
||||
unlockOutputBuffer();
|
||||
|
|
|
@ -27,6 +27,11 @@ static LENameOrdinalPair leAnd(LE_OPERATOR_AND, "and");
|
|||
static LENameOrdinalPair leOr(LE_OPERATOR_OR, "or");
|
||||
static LENameOrdinalPair leNot(LE_OPERATOR_NOT, "not");
|
||||
|
||||
static LENameOrdinalPair leAdd(LE_OPERATOR_ADDITION, "+");
|
||||
static LENameOrdinalPair leSub(LE_OPERATOR_SUBSTRACTION, "-");
|
||||
static LENameOrdinalPair leMul(LE_OPERATOR_MULTIPLICATION, "*");
|
||||
static LENameOrdinalPair leDiv(LE_OPERATOR_DIVISION, "/");
|
||||
|
||||
static LENameOrdinalPair leMore(LE_OPERATOR_MORE, ">");
|
||||
static LENameOrdinalPair leMoreOrEqual(LE_OPERATOR_MORE_OR_EQUAL, ">=");
|
||||
|
||||
|
@ -147,6 +152,38 @@ void LECalculator::doJob(Engine *engine, LEElement *element) {
|
|||
float v1 = pop(LE_OPERATOR_MORE);
|
||||
|
||||
stack.push(v1 > v2);
|
||||
}
|
||||
break;
|
||||
case LE_OPERATOR_ADDITION: {
|
||||
// elements on stack are in reverse order
|
||||
float v2 = pop(LE_OPERATOR_MORE);
|
||||
float v1 = pop(LE_OPERATOR_MORE);
|
||||
|
||||
stack.push(v1 + v2);
|
||||
}
|
||||
break;
|
||||
case LE_OPERATOR_SUBSTRACTION: {
|
||||
// elements on stack are in reverse order
|
||||
float v2 = pop(LE_OPERATOR_MORE);
|
||||
float v1 = pop(LE_OPERATOR_MORE);
|
||||
|
||||
stack.push(v1 - v2);
|
||||
}
|
||||
break;
|
||||
case LE_OPERATOR_MULTIPLICATION: {
|
||||
// elements on stack are in reverse order
|
||||
float v2 = pop(LE_OPERATOR_MORE);
|
||||
float v1 = pop(LE_OPERATOR_MORE);
|
||||
|
||||
stack.push(v1 * v2);
|
||||
}
|
||||
break;
|
||||
case LE_OPERATOR_DIVISION: {
|
||||
// elements on stack are in reverse order
|
||||
float v2 = pop(LE_OPERATOR_MORE);
|
||||
float v1 = pop(LE_OPERATOR_MORE);
|
||||
|
||||
stack.push(v1 / v2);
|
||||
}
|
||||
break;
|
||||
case LE_OPERATOR_LESS_OR_EQUAL: {
|
||||
|
@ -292,6 +329,7 @@ LEElement *LEElementPool::parseExpression(const char * line) {
|
|||
#if (EFI_PROD_CODE || EFI_SIMULATOR)
|
||||
|
||||
static void eval(char *line, Engine *engine) {
|
||||
line = unquote(line);
|
||||
scheduleMsg(&logger, "Parsing [%s]", line);
|
||||
evalPool.reset();
|
||||
LEElement * e = evalPool.parseExpression(line);
|
||||
|
|
|
@ -23,6 +23,10 @@ typedef enum {
|
|||
LE_OPERATOR_AND = 6,
|
||||
LE_OPERATOR_OR = 7,
|
||||
LE_OPERATOR_NOT = 8,
|
||||
LE_OPERATOR_ADDITION = 9,
|
||||
LE_OPERATOR_SUBSTRACTION = 10,
|
||||
LE_OPERATOR_MULTIPLICATION = 11,
|
||||
LE_OPERATOR_DIVISION = 12,
|
||||
|
||||
LE_METHOD_RPM = 100,
|
||||
LE_METHOD_COOLANT = 101,
|
||||
|
|
|
@ -416,4 +416,5 @@ void initEngineContoller(Engine *engine) {
|
|||
}
|
||||
|
||||
addConsoleActionSSP("set_user_out", (VoidCharPtrCharPtrVoidPtr) setUserOutput, engine);
|
||||
initEval(engine);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "event_queue.h"
|
||||
#include "efitime.h"
|
||||
|
||||
|
@ -74,6 +75,8 @@ uint64_t EventQueue::getNextEventTime(uint64_t nowX) {
|
|||
return nextTimeUs;
|
||||
}
|
||||
|
||||
// static scheduling_s * longScheduling;
|
||||
|
||||
/**
|
||||
* Invoke all pending actions prior to specified timestamp
|
||||
* @return true if at least one action was executed
|
||||
|
@ -105,7 +108,14 @@ bool EventQueue::executeAll(uint64_t now) {
|
|||
bool result = (executionList != NULL);
|
||||
LL_FOREACH_SAFE(executionList, current, tmp)
|
||||
{
|
||||
// uint32_t before = hal_lld_get_counter_value();
|
||||
current->callback(current->param);
|
||||
// even with overflow it's safe to substract here
|
||||
// uint32_t cost = hal_lld_get_counter_value() - before;
|
||||
// if (cost > 2000) {
|
||||
// longScheduling = current;
|
||||
// cost++;
|
||||
// }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,10 @@ float maxF(float i1, float i2) {
|
|||
}
|
||||
|
||||
uint32_t efiStrlen(const char *param) {
|
||||
return strlen(param);
|
||||
register const char *s;
|
||||
for (s = param; *s; ++s)
|
||||
;
|
||||
return (s - param);
|
||||
}
|
||||
|
||||
bool startsWith(const char *line, const char *prefix) {
|
||||
|
|
Loading…
Reference in New Issue