Skip to content
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

Merged
merged 10 commits into from
Nov 28, 2024
Merged

BENB potentiometer centering #128

merged 10 commits into from
Nov 28, 2024

Conversation

benblaise-intech
Copy link
Contributor

No description provided.

codescene-delta-analysis[bot]

This comment was marked as outdated.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

@SukuWc SukuWc marked this pull request as ready for review November 26, 2024 13:37
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link
Member

@SukuWc SukuWc left a 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!

cal->center = malloc(cal->length * sizeof(uint16_t));
cal->enable = malloc(cal->length * sizeof(uint8_t));

const uint16_t half_value = cal->maximum >> 1;
Copy link
Member

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

return cal->value[channel];
}

uint16_t restrict_to_range(uint16_t x, uint16_t min, uint16_t max) {
Copy link
Member

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


cal->maximum = 1 << cal->resolution;

cal->value = malloc(cal->length * sizeof(uint16_t));
Copy link
Member

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;
}
Copy link
Member

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
Copy link
Member

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

Copy link
Contributor Author

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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

grid_common/grid_lua_api.c Show resolved Hide resolved
@@ -1590,6 +1590,109 @@
return 1;
}

/*static*/ int l_grid_potmeter_calibration_get(lua_State* L) {

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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a 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

Comment on lines +98 to +112
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);
}

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

Suppress

@SukuWc SukuWc merged commit d7af57b into master Nov 28, 2024
10 checks passed
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