1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Some more const qualifiers, and including sonar for configuration list.

This commit is contained in:
blckmn 2016-10-04 07:14:37 +11:00 committed by blckmn
parent c578c9d6bc
commit 6ea3e47f56
4 changed files with 7 additions and 3 deletions

View file

@ -63,7 +63,7 @@ void hcsr04_extiHandler(extiCallbackRec_t* cb)
}
}
void hcsr04_init(sonarRange_t *sonarRange, sonarConfig_t *sonarConfig)
void hcsr04_init(const sonarConfig_t *sonarConfig, sonarRange_t *sonarRange)
{
sonarRange->maxRangeCm = HCSR04_MAX_RANGE_CM;
sonarRange->detectionConeDeciDegrees = HCSR04_DETECTION_CONE_DECIDEGREES;

View file

@ -37,6 +37,6 @@ typedef struct sonarRange_s {
#define HCSR04_DETECTION_CONE_DECIDEGREES 300 // recommended cone angle30 degrees, from HC-SR04 spec sheet
#define HCSR04_DETECTION_CONE_EXTENDED_DECIDEGREES 450 // in practice 45 degrees seems to work well
void hcsr04_init(sonarRange_t *sonarRange, sonarConfig_t *sonarConfig);
void hcsr04_init(const sonarConfig_t *sonarConfig, sonarRange_t *sonarRange);
void hcsr04_start_reading(void);
int32_t hcsr04_get_distance(void);

View file

@ -3691,6 +3691,10 @@ const cliResourceValue_t resourceTable[] = {
{ OWNER_PPMINPUT, &masterConfig.ppmConfig.ioTag, 0 },
{ OWNER_PWMINPUT, &masterConfig.pwmConfig.ioTags[0], PWM_INPUT_PORT_COUNT },
#endif
#ifdef SONAR
{ OWNER_SONAR_TRIGGER, &masterConfig.sonarConfig.triggerTag, 0 },
{ OWNER_SONAR_ECHO, &masterConfig.sonarConfig.echoTag, 0 },
#endif
};
static void cliResource(char *cmdline)

View file

@ -54,7 +54,7 @@ void sonarInit(const sonarConfig_t *sonarConfig)
{
sonarRange_t sonarRange;
hcsr04_init(&sonarRange, sonarConfig);
hcsr04_init(sonarConfig, &sonarRange);
sensorsSet(SENSOR_SONAR);
sonarMaxRangeCm = sonarRange.maxRangeCm;