motorctl, currentsensor: - add config option for inverted current sensor - adjust loglevels config: - Adjust gpio pins to actual wiring (not breakout board for testing) - Add min pulse durations for speedsensors (measurements with scope) - Adjust config to currently mounted encoders control, buzzer: - adjust beeping - Add feature for optinal delay to buzzer class: have some pause after beeps instead of immediately continuing with next queued sequence
22 lines
553 B
C++
22 lines
553 B
C++
#include <driver/adc.h>
|
|
|
|
//supported current sensor working method:
|
|
//0V = -ratedCurrent
|
|
//centerVoltage = 0A
|
|
//3.3V = ratedCurrent
|
|
|
|
class currentSensor{
|
|
public:
|
|
currentSensor (adc1_channel_t adcChannel_f, float ratedCurrent, bool inverted = false);
|
|
void calibrateZeroAmpere(void); //set current voltage to voltage representing 0A
|
|
float read(void); //get current ampere
|
|
private:
|
|
adc1_channel_t adcChannel;
|
|
float ratedCurrent;
|
|
bool isInverted;
|
|
uint32_t measure;
|
|
float voltage;
|
|
float current;
|
|
float centerVoltage = 3.3/2;
|
|
};
|