1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Updated accgyro locking. Printf tidy

This commit is contained in:
Martin Budden 2017-04-10 14:34:21 +01:00
parent 8eebf06753
commit 0219d6adc7
13 changed files with 109 additions and 107 deletions

View file

@ -1908,12 +1908,12 @@ static void cliSerialPassthrough(char *cmdline)
tok = strtok_r(NULL, " ", &saveptr);
}
printf("Port %d ", id);
tfp_printf("Port %d ", id);
serialPort_t *passThroughPort;
serialPortUsage_t *passThroughPortUsage = findSerialPortUsageByIdentifier(id);
if (!passThroughPortUsage || passThroughPortUsage->serialPort == NULL) {
if (!baud) {
printf("closed, specify baud.\r\n");
tfp_printf("closed, specify baud.\r\n");
return;
}
if (!mode)
@ -1923,17 +1923,17 @@ static void cliSerialPassthrough(char *cmdline)
baud, mode,
SERIAL_NOT_INVERTED);
if (!passThroughPort) {
printf("could not be opened.\r\n");
tfp_printf("could not be opened.\r\n");
return;
}
printf("opened, baud = %d.\r\n", baud);
tfp_printf("opened, baud = %d.\r\n", baud);
} else {
passThroughPort = passThroughPortUsage->serialPort;
// If the user supplied a mode, override the port's mode, otherwise
// leave the mode unchanged. serialPassthrough() handles one-way ports.
printf("already open.\r\n");
tfp_printf("already open.\r\n");
if (mode && passThroughPort->mode != mode) {
printf("mode changed from %d to %d.\r\n",
tfp_printf("mode changed from %d to %d.\r\n",
passThroughPort->mode, mode);
serialSetMode(passThroughPort, mode);
}
@ -1944,7 +1944,7 @@ static void cliSerialPassthrough(char *cmdline)
}
}
printf("forwarding, power cycle to exit.\r\n");
tfp_printf("forwarding, power cycle to exit.\r\n");
serialPassthrough(cliPort, passThroughPort, NULL, NULL);
}
@ -3227,11 +3227,11 @@ static void cliGpsPassthrough(char *cmdline)
static int parseEscNumber(char *pch, bool allowAllEscs) {
int escNumber = atoi(pch);
if ((escNumber >= 0) && (escNumber < getMotorCount())) {
printf("Programming on ESC %d.\r\n", escNumber);
tfp_printf("Programming on ESC %d.\r\n", escNumber);
} else if (allowAllEscs && escNumber == ALL_ESCS) {
printf("Programming on all ESCs.\r\n");
tfp_printf("Programming on all ESCs.\r\n");
} else {
printf("Invalid ESC number, range: 0 to %d.\r\n", getMotorCount() - 1);
tfp_printf("Invalid ESC number, range: 0 to %d.\r\n", getMotorCount() - 1);
return -1;
}
@ -3279,9 +3279,9 @@ static void cliDshotProg(char *cmdline)
delay(10); // wait for sound output to finish
}
printf("Command %d written.\r\n", command);
tfp_printf("Command %d written.\r\n", command);
} else {
printf("Invalid command, range 1 to %d.\r\n", DSHOT_MIN_THROTTLE - 1);
tfp_printf("Invalid command, range 1 to %d.\r\n", DSHOT_MIN_THROTTLE - 1);
}
break;
@ -3726,7 +3726,7 @@ static void cliTasks(char *cmdline)
getTaskInfo(taskId, &taskInfo);
if (taskInfo.isEnabled) {
int taskFrequency;
int subTaskFrequency;
int subTaskFrequency = 0;
if (taskId == TASK_GYROPID) {
subTaskFrequency = taskInfo.latestDeltaTime == 0 ? 0 : (int)(1000000.0f / ((float)taskInfo.latestDeltaTime));
taskFrequency = subTaskFrequency / pidConfig()->pid_process_denom;