-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BENB potentiometer centering #128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: -0.20 (6.85 -> 6.65)
- Improving Code Health: 1 findings(s) ✅
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: +0.02 (6.85 -> 6.88)
- Improving Code Health: 1 findings(s) ✅
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: +0.03 (6.85 -> 6.89)
- Improving Code Health: 1 findings(s) ✅
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: +0.03 (6.85 -> 6.89)
- Improving Code Health: 1 findings(s) ✅
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: +0.06 (6.64 -> 6.69)
- Improving Code Health: 1 findings(s) ✅
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good general implementation, fits architecture well!
Todo: Please implement the changes regarding code style!
grid_common/grid_cal.c
Outdated
cal->center = malloc(cal->length * sizeof(uint16_t)); | ||
cal->enable = malloc(cal->length * sizeof(uint8_t)); | ||
|
||
const uint16_t half_value = cal->maximum >> 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use cal->maximum/2 for readability
grid_common/grid_cal.c
Outdated
return cal->value[channel]; | ||
} | ||
|
||
uint16_t restrict_to_range(uint16_t x, uint16_t min, uint16_t max) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag internal methods with the static keyword
grid_common/grid_cal.c
Outdated
|
||
cal->maximum = 1 << cal->resolution; | ||
|
||
cal->value = malloc(cal->length * sizeof(uint16_t)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cast result of malloc to uint16_t* for CPP compatibility
|
||
if (!cal->enable[channel]) { | ||
return 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only implement return status if status is actually checked. Otherwise stick to void.
if you decide to implement and check status, make sure it's type is int.
@@ -393,6 +393,14 @@ | |||
#define GRID_LUA_FNC_G_ELEMENT_COUNT_fnptr l_grid_element_count | |||
#define GRID_LUA_FNC_G_ELEMENT_COUNT_usage "element_count(void) Returns the number of elements on the current module." | |||
|
|||
#define GRID_LUA_FNC_G_POTMETER_CALIBRATION_GET_short "gpcg" | |||
#define GRID_LUA_FNC_G_POTMETER_CALIBRATION_GET_human "potmeter_calibration_get" | |||
#define GRID_LUA_FNC_G_POTMETER_CALIBRATION_GET_fnptr l_grid_potmeter_calibration_get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always add usage explaining string (similar to #define GRID_LUA_FNC_G_ELEMENT_COUNT_usage) for use in editor UX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add in a commit after 9d39ceb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Code Health Quality Gates: FAILED
Change in average Code Health of affected files: -0.22 (6.64 -> 6.42)
- Declining Code Health: 2 findings(s) 🚩
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
@@ -1590,6 +1590,109 @@ | |||
return 1; | |||
} | |||
|
|||
/*static*/ int l_grid_potmeter_calibration_get(lua_State* L) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 5.06 to 5.20, threshold = 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: -0.22 (6.64 -> 6.42)
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: -0.22 (6.64 -> 6.42)
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: -0.22 (6.64 -> 6.42)
- Declining Code Health: 1 findings(s) 🚩
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Health Quality Gates: OK
Change in average Code Health of affected files: -0.22 (6.64 -> 6.41)
- Declining Code Health: 1 findings(s) 🚩
View detailed results in CodeScene
Absence of Expected Change Pattern
- grid-fw/grid_esp/components/grid_esp32_module_pbf4/grid_esp32_module_pbf4.c is usually changed with: grid-fw/grid_esp/components/grid_esp32_module_bu16/grid_esp32_module_bu16.c
static int32_t inverse_error_centering(int32_t a, int32_t b, float x, float c, uint8_t iter) { | ||
|
||
for (uint8_t i = 0; i < iter; ++i) { | ||
|
||
if (x < c) { | ||
b = (a + b) / 2; | ||
x = x / c; | ||
} else { | ||
a = (a + b) / 2; | ||
x = (x - c) / (1.0 - c); | ||
} | ||
} | ||
|
||
return lerp(a, b, x); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ New issue: Excess Number of Function Arguments
inverse_error_centering has 5 arguments, threshold = 4
No description provided.