Adding more servos
[inav.git] / src / main / flight / power_limits.h
blobd5b877273be858c15ea96012327dfb017e2e2c12
1 /*
2 * This file is part of INAV
4 * INAV free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * INAV distributed in the hope that it
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include <stdbool.h>
24 #include <stdint.h>
26 #include <common/time.h>
28 #include "platform.h"
30 #include "config/parameter_group.h"
32 #if defined(USE_POWER_LIMITS)
34 typedef struct {
35 uint16_t piP;
36 uint16_t piI;
38 float attnFilterCutoff; // Hz
39 } powerLimitsConfig_t;
41 PG_DECLARE(powerLimitsConfig_t, powerLimitsConfig);
43 void powerLimiterInit(void);
44 void currentLimiterUpdate(timeDelta_t timeDelta);
45 void powerLimiterUpdate(timeDelta_t timeDelta);
46 void powerLimiterApply(int16_t *throttleCommand);
47 bool powerLimiterIsLimiting(void);
48 bool powerLimiterIsLimitingCurrent(void);
49 float powerLimiterGetRemainingBurstTime(void); // returns seconds
50 uint16_t powerLimiterGetActiveCurrentLimit(void); // returns cA
51 #ifdef USE_ADC
52 uint16_t powerLimiterGetActivePowerLimit(void); // returns cW
53 bool powerLimiterIsLimitingPower(void);
54 #endif
56 #endif