Skip to content

fix current sensor#32

Open
RichardASC24 wants to merge 1 commit into
mainfrom
Current-Sensor-Richard
Open

fix current sensor#32
RichardASC24 wants to merge 1 commit into
mainfrom
Current-Sensor-Richard

Conversation

@RichardASC24

Copy link
Copy Markdown

No description provided.

Comment thread CurrentSensor.cpp
static const float u90 = 0.5f;
static const float K = 1.4722f / u90;

static const float alpha_min = 0.5f;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants define how wide the band is of the filter, setting them equal will remove the adaptive aspect of your filter, these values must be changed

Comment thread CurrentSensor.cpp
{}


// ================= Initialization =================

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Headers should sit on top of what your documenting

Comment thread CurrentSensor.cpp
// ================= Initialization =================

void CurrentSensor::begin() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary spacing

Comment thread CurrentSensor.cpp

// ================= Initialization =================

void CurrentSensor::begin() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to setup to keep things consistent in .ino setup function

Comment thread CurrentSensor.cpp
#include "CurrentSensor.h"
#include <math.h>

// ================= Filter Parameters =================

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables are meaningless without context, give them some comments regarding what they change

Comment thread CurrentSensor.cpp

void CurrentSensor::begin() {

pinMode(_adcPin, INPUT);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use snake_case for variables

Comment thread CurrentSensor.h
private:

// Hardware
uint8_t _adcPin;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snake_case for variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants