auto-sync
This commit is contained in:
parent
16f8c7c42b
commit
d51cd692f4
|
@ -49,7 +49,7 @@ static EventListener consoleEventListener;
|
|||
static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size) {
|
||||
char *p = line;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (!isConsoleReady()) {
|
||||
// we better do not read from USB serial before it is ready
|
||||
chThdSleepMilliseconds(10);
|
||||
|
@ -82,7 +82,7 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
|
|||
#endif
|
||||
|
||||
if (c < 0 || c == 4) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
if (c == 8) {
|
||||
if (p != line) {
|
||||
|
|
|
@ -25,6 +25,7 @@ SimplePwm::SimplePwm() {
|
|||
void PwmConfig::baseConstructor() {
|
||||
memset(&scheduling, 0, sizeof(scheduling));
|
||||
memset(&safe, 0, sizeof(safe));
|
||||
dbgNestingLevel = 0;
|
||||
scheduling.name = "PwmConfig";
|
||||
periodNt = NAN;
|
||||
memset(&outputPins, 0, sizeof(outputPins));
|
||||
|
@ -107,7 +108,7 @@ static efitimeus_t togglePwmState(PwmConfig *state) {
|
|||
/**
|
||||
* NaN period means PWM is paused
|
||||
*/
|
||||
return MS2US(1);
|
||||
return getTimeNowUs() + MS2US(100);
|
||||
}
|
||||
|
||||
state->handleCycleStart();
|
||||
|
@ -150,8 +151,12 @@ static efitimeus_t togglePwmState(PwmConfig *state) {
|
|||
* Main PWM loop: toggle pin & schedule next invocation
|
||||
*/
|
||||
static void timerCallback(PwmConfig *state) {
|
||||
state->dbgNestingLevel++;
|
||||
efiAssertVoid(state->dbgNestingLevel < 25, "PWM nesting issue");
|
||||
|
||||
efitimeus_t switchTimeUs = togglePwmState(state);
|
||||
scheduleByTime("pwm", &state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state);
|
||||
state->dbgNestingLevel--;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,6 +63,8 @@ public:
|
|||
*/
|
||||
float periodNt;
|
||||
|
||||
int dbgNestingLevel;
|
||||
|
||||
scheduling_s scheduling;
|
||||
|
||||
pwm_config_safe_state_s safe;
|
||||
|
@ -77,7 +79,7 @@ public:
|
|||
pwm_cycle_callback *cycleCallback;
|
||||
|
||||
/**
|
||||
* this main callback is invoked when it's time to switch level on amy of the output channels
|
||||
* this main callback is invoked when it's time to switch level on any of the output channels
|
||||
*/
|
||||
pwm_gen_callback *stateChangeCallback;
|
||||
};
|
||||
|
|
|
@ -117,7 +117,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
|
|||
eventCount[triggerWheel]++;
|
||||
eventCountExt[signal]++;
|
||||
|
||||
int isLessImportant = (TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_UP)
|
||||
bool_t isLessImportant = (TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_UP)
|
||||
|| (!TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_DOWN);
|
||||
|
||||
uint64_t currentDurationLong = getCurrentGapDuration(nowNt);
|
||||
|
|
|
@ -429,8 +429,11 @@ char *validateSecureLine(char *line) {
|
|||
}
|
||||
|
||||
static char confirmation[200];
|
||||
static char handleBuffer[200];
|
||||
|
||||
static bool handleConsoleLineInternal(char *line, int lineLength) {
|
||||
static bool handleConsoleLineInternal(const char *commandLine, int lineLength) {
|
||||
strncpy(handleBuffer, commandLine, sizeof(handleBuffer));
|
||||
char *line = handleBuffer;
|
||||
int firstTokenLength = tokenLength(line);
|
||||
|
||||
// print("processing [%s] with %d actions\r\n", line, consoleActionCount);
|
||||
|
@ -497,6 +500,8 @@ void handleConsoleLine(char *line) {
|
|||
|
||||
bool isKnownComman = handleConsoleLineInternal(line, lineLength);
|
||||
|
||||
if (!isKnownComman)
|
||||
if (!isKnownComman) {
|
||||
scheduleMsg(logging, "unknown [%s]", line);
|
||||
helpCommand();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue