1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00
betaflight/src/main/fc/config.h
Bruce Luckcuck f5bc673ada Revise PID/Rate profile names to use get/set and eliminate extra PG's
Removes the custom CLI commands to update or display the PID and Rate profile names. Moves the storage into the pidProfile and controlRateProfile PG's.

Names can now be set with:
set profile_name = NAME
set rate_profile_name = NAME

Also added profile name display to the profile and rate CMS menus.
2019-05-08 09:03:31 -04:00

88 lines
2.4 KiB
C

/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "pg/pg.h"
#define MAX_NAME_LENGTH 16u
#define MAX_PROFILE_NAME_LENGTH 8u
typedef struct pilotConfig_s {
char name[MAX_NAME_LENGTH + 1];
char displayName[MAX_NAME_LENGTH + 1];
} pilotConfig_t;
PG_DECLARE(pilotConfig_t, pilotConfig);
typedef struct systemConfig_s {
uint8_t pidProfileIndex;
uint8_t activeRateProfile;
uint8_t debug_mode;
uint8_t task_statistics;
uint8_t rateProfile6PosSwitch;
uint8_t cpu_overclock;
uint8_t powerOnArmingGraceTime; // in seconds
char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1];
uint8_t hseMhz; // Not used for non-F4 targets
uint8_t configured;
uint8_t schedulerOptimizeRate;
} systemConfig_t;
PG_DECLARE(systemConfig_t, systemConfig);
struct pidProfile_s;
extern struct pidProfile_s *currentPidProfile;
void initEEPROM(void);
void resetEEPROM(void);
bool readEEPROM(void);
void writeEEPROM(void);
void writeEEPROMWithFeatures(uint32_t features);
void ensureEEPROMStructureIsValid(void);
void saveConfigAndNotify(void);
void validateAndFixGyroConfig(void);
void setConfigDirty(void);
bool isConfigDirty(void);
uint8_t getCurrentPidProfileIndex(void);
void changePidProfile(uint8_t pidProfileIndex);
void changePidProfileFromCellCount(uint8_t cellCount);
struct pidProfile_s;
void resetPidProfile(struct pidProfile_s *profile);
uint8_t getCurrentControlRateProfileIndex(void);
void changeControlRateProfile(uint8_t profileIndex);
bool canSoftwareSerialBeUsed(void);
uint16_t getCurrentMinthrottle(void);
void resetConfigs(void);
void targetConfiguration(void);
void targetValidateConfiguration(void);
bool isSystemConfigured(void);