Added CLI option to set serial task update rate
This commit is contained in:
parent
24a384b541
commit
aab9c7135b
|
@ -439,10 +439,11 @@ void resetBatteryConfig(batteryConfig_t *batteryConfig)
|
|||
|
||||
void resetSerialConfig(serialConfig_t *serialConfig)
|
||||
{
|
||||
uint8_t index;
|
||||
memset(serialConfig, 0, sizeof(serialConfig_t));
|
||||
serialConfig->serial_update_rate_hz = 100;
|
||||
serialConfig->reboot_character = 'R';
|
||||
|
||||
for (index = 0; index < SERIAL_PORT_COUNT; index++) {
|
||||
for (int index = 0; index < SERIAL_PORT_COUNT; index++) {
|
||||
serialConfig->portConfigs[index].identifier = serialPortIdentifiers[index];
|
||||
serialConfig->portConfigs[index].msp_baudrateIndex = BAUD_115200;
|
||||
serialConfig->portConfigs[index].gps_baudrateIndex = BAUD_57600;
|
||||
|
@ -451,13 +452,10 @@ void resetSerialConfig(serialConfig_t *serialConfig)
|
|||
}
|
||||
|
||||
serialConfig->portConfigs[0].functionMask = FUNCTION_MSP;
|
||||
|
||||
#if defined(USE_VCP)
|
||||
// This allows MSP connection via USART & VCP so the board can be reconfigured.
|
||||
serialConfig->portConfigs[1].functionMask = FUNCTION_MSP;
|
||||
#endif
|
||||
|
||||
serialConfig->reboot_character = 'R';
|
||||
}
|
||||
|
||||
void resetRcControlsConfig(rcControlsConfig_t *rcControlsConfig)
|
||||
|
|
|
@ -230,6 +230,7 @@ void fcTasksInit(void)
|
|||
|
||||
setTaskEnabled(TASK_ATTITUDE, sensors(SENSOR_ACC));
|
||||
setTaskEnabled(TASK_SERIAL, true);
|
||||
rescheduleTask(TASK_SERIAL, TASK_PERIOD_HZ(serialConfig()->serial_update_rate_hz));
|
||||
setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER));
|
||||
setTaskEnabled(TASK_RX, true);
|
||||
|
||||
|
|
|
@ -524,6 +524,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "fixedwing_althold_dir", VAR_INT8 | MASTER_VALUE, &airplaneConfig()->fixedwing_althold_dir, .config.minmax = { -1, 1 } },
|
||||
|
||||
{ "reboot_character", VAR_UINT8 | MASTER_VALUE, &serialConfig()->reboot_character, .config.minmax = { 48, 126 } },
|
||||
{ "serial_update_rate_hz", VAR_UINT16 | MASTER_VALUE, &serialConfig()->serial_update_rate_hz, .config.minmax = { 100, 2000 } },
|
||||
|
||||
#ifdef GPS
|
||||
{ "gps_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &gpsConfig()->provider, .config.lookup = { TABLE_GPS_PROVIDER } },
|
||||
|
|
|
@ -96,8 +96,8 @@ serialPort_t *findNextSharedSerialPort(uint16_t functionMask, serialPortFunction
|
|||
// configuration
|
||||
//
|
||||
typedef struct serialPortConfig_s {
|
||||
serialPortIdentifier_e identifier;
|
||||
uint16_t functionMask;
|
||||
serialPortIdentifier_e identifier;
|
||||
uint8_t msp_baudrateIndex;
|
||||
uint8_t gps_baudrateIndex;
|
||||
uint8_t blackbox_baudrateIndex;
|
||||
|
@ -105,8 +105,9 @@ typedef struct serialPortConfig_s {
|
|||
} serialPortConfig_t;
|
||||
|
||||
typedef struct serialConfig_s {
|
||||
uint8_t reboot_character; // which byte is used to reboot. Default 'R', could be changed carefully to something else.
|
||||
serialPortConfig_t portConfigs[SERIAL_PORT_COUNT];
|
||||
uint16_t serial_update_rate_hz;
|
||||
uint8_t reboot_character; // which byte is used to reboot. Default 'R', could be changed carefully to something else.
|
||||
} serialConfig_t;
|
||||
|
||||
typedef void serialConsumer(uint8_t);
|
||||
|
|
Loading…
Reference in New Issue