@@ -289,6 +290,41 @@ const Analog = ({ values, errors, handleChange, handleCheckbox }) => {
min={0}
max={100}
/>
+
+
+ {ANALOG_ERROR_RATES.map(
+ (o, i) =>
+ console.log(o, 'hehu') || (
+
+ ),
+ )}
+
+
{
handleChange(e);
}}
/>
-
- {ANALOG_ERROR_RATES.map((o, i) => (
-
- ))}
-
{
handleChange(e);
}}
/>
-
Date: Sun, 15 Sep 2024 21:35:48 +0200
Subject: [PATCH 4/7] Fix key error for focus mode
---
www/src/Addons/FocusMode.tsx | 59 ++++++++++++++++++------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/www/src/Addons/FocusMode.tsx b/www/src/Addons/FocusMode.tsx
index ac444fb8e..606ee89e4 100644
--- a/www/src/Addons/FocusMode.tsx
+++ b/www/src/Addons/FocusMode.tsx
@@ -93,36 +93,35 @@ const FocusMode = ({
/>
- {BUTTON_MASKS_OPTIONS.map((mask) =>
- values.focusModeButtonLockMask & mask.value ? (
- {
- setFieldValue(
- 'focusModeButtonLockMask',
- (values.focusModeButtonLockMask ^ mask.value) |
- e.target.value,
- );
- }}
- >
- {BUTTON_MASKS_OPTIONS.map((o, i) => (
-
- ))}
-
- ) : (
- <>>
- ),
+ {BUTTON_MASKS_OPTIONS.map(
+ (mask) =>
+ Boolean(values.focusModeButtonLockMask & mask.value) && (
+ {
+ setFieldValue(
+ 'focusModeButtonLockMask',
+ (values.focusModeButtonLockMask ^ mask.value) |
+ e.target.value,
+ );
+ }}
+ >
+ {BUTTON_MASKS_OPTIONS.map((o, i) => (
+
+ ))}
+
+ ),
)}
Date: Sun, 15 Sep 2024 21:37:32 +0200
Subject: [PATCH 5/7] Remove logging used to check values
---
www/src/Addons/Analog.tsx | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/www/src/Addons/Analog.tsx b/www/src/Addons/Analog.tsx
index 55a62e9a5..f5b75ed7e 100644
--- a/www/src/Addons/Analog.tsx
+++ b/www/src/Addons/Analog.tsx
@@ -302,14 +302,11 @@ const Analog = ({ values, errors, handleChange, handleCheckbox }) => {
isInvalid={errors.analog_error}
onChange={handleChange}
>
- {ANALOG_ERROR_RATES.map(
- (o, i) =>
- console.log(o, 'hehu') || (
-
- ),
- )}
+ {ANALOG_ERROR_RATES.map((o, i) => (
+
+ ))}
Date: Mon, 16 Sep 2024 22:26:58 -0700
Subject: [PATCH 6/7] fix errors and initial value
---
headers/addons/analog.h | 2 +-
www/src/Addons/Analog.tsx | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/headers/addons/analog.h b/headers/addons/analog.h
index ad1784e22..7e1b1d9df 100644
--- a/headers/addons/analog.h
+++ b/headers/addons/analog.h
@@ -70,7 +70,7 @@
#endif
#ifndef ANALOG_ERROR
-#define ANALOG_ERROR 0
+#define ANALOG_ERROR 1
#endif
// Analog Module Name
diff --git a/www/src/Addons/Analog.tsx b/www/src/Addons/Analog.tsx
index f5b75ed7e..441bc3ebb 100644
--- a/www/src/Addons/Analog.tsx
+++ b/www/src/Addons/Analog.tsx
@@ -23,7 +23,7 @@ const INVERT_MODES = [
];
const ANALOG_ERROR_RATES = [
- { label: '0%', value: 1.0 },
+ { label: '0%', value: 1 },
{ label: '1%', value: 0.99 },
{ label: '2%', value: 0.979 },
{ label: '3%', value: 0.969 },
@@ -122,7 +122,7 @@ export const analogState = {
auto_calibrate: 0,
analog_smoothing: 0,
smoothing_factor: 5,
- analog_error: 1.0,
+ analog_error: 1,
};
const Analog = ({ values, errors, handleChange, handleCheckbox }) => {
@@ -298,8 +298,6 @@ const Analog = ({ values, errors, handleChange, handleCheckbox }) => {
className="form-control-sm"
groupClassName="col-sm-3 mb-3"
value={values.analog_error}
- error={errors.analog_error}
- isInvalid={errors.analog_error}
onChange={handleChange}
>
{ANALOG_ERROR_RATES.map((o, i) => (
From df7e541f61faaeb0508c2314290d5ac668398d2a Mon Sep 17 00:00:00 2001
From: NickGuyver <29263310+NickGuyver@users.noreply.github.com>
Date: Tue, 17 Sep 2024 08:39:32 -0700
Subject: [PATCH 7/7] remove web floats
---
headers/addons/analog.h | 2 +-
proto/config.proto | 2 +-
src/addons/analog.cpp | 2 +-
www/server/app.js | 2 +-
www/src/Addons/Analog.tsx | 32 ++++++++++++++++----------------
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/headers/addons/analog.h b/headers/addons/analog.h
index 7e1b1d9df..22eccee3f 100644
--- a/headers/addons/analog.h
+++ b/headers/addons/analog.h
@@ -70,7 +70,7 @@
#endif
#ifndef ANALOG_ERROR
-#define ANALOG_ERROR 1
+#define ANALOG_ERROR 1000
#endif
// Analog Module Name
diff --git a/proto/config.proto b/proto/config.proto
index 6ad82f15c..67ed33459 100644
--- a/proto/config.proto
+++ b/proto/config.proto
@@ -353,7 +353,7 @@ message AnalogOptions
optional uint32 outer_deadzone = 13;
optional bool analog_smoothing = 14;
optional float smoothing_factor = 15;
- optional float analog_error = 16;
+ optional uint32 analog_error = 16;
}
message TurboOptions
diff --git a/src/addons/analog.cpp b/src/addons/analog.cpp
index e0cd9c154..c8d0a8188 100644
--- a/src/addons/analog.cpp
+++ b/src/addons/analog.cpp
@@ -66,7 +66,7 @@ void AnalogInput::process()
bool ema_option = analogOptions.analog_smoothing;
float ema_smoothing = analogOptions.smoothing_factor / 1000.0f;
- float error_rate = analogOptions.analog_error;
+ float error_rate = analogOptions.analog_error / 1000.0f;
struct adc_pair
{
diff --git a/www/server/app.js b/www/server/app.js
index 6e2e92f11..0263f8cdb 100644
--- a/www/server/app.js
+++ b/www/server/app.js
@@ -431,7 +431,7 @@ app.get('/api/getAddonsOptions', (req, res) => {
auto_calibrate: 0,
analog_smoothing: 0,
smoothing_factor: 5,
- analog_error: 1.0,
+ analog_error: 1000,
bootselButtonMap: 0,
buzzerPin: -1,
buzzerEnablePin: -1,
diff --git a/www/src/Addons/Analog.tsx b/www/src/Addons/Analog.tsx
index 441bc3ebb..e42ffbc1a 100644
--- a/www/src/Addons/Analog.tsx
+++ b/www/src/Addons/Analog.tsx
@@ -23,22 +23,22 @@ const INVERT_MODES = [
];
const ANALOG_ERROR_RATES = [
- { label: '0%', value: 1 },
- { label: '1%', value: 0.99 },
- { label: '2%', value: 0.979 },
- { label: '3%', value: 0.969 },
- { label: '4%', value: 0.958 },
- { label: '5%', value: 0.946 },
- { label: '6%', value: 0.934 },
- { label: '7%', value: 0.922 },
- { label: '8%', value: 0.911 },
- { label: '9%', value: 0.9 },
- { label: '10%', value: 0.89 },
- { label: '11%', value: 0.876 },
- { label: '12%', value: 0.863 },
- { label: '13%', value: 0.848 },
- { label: '14%', value: 0.834 },
- { label: '15%', value: 0.821 },
+ { label: '0%', value: 1000 },
+ { label: '1%', value: 990 },
+ { label: '2%', value: 979 },
+ { label: '3%', value: 969 },
+ { label: '4%', value: 958 },
+ { label: '5%', value: 946 },
+ { label: '6%', value: 934 },
+ { label: '7%', value: 922 },
+ { label: '8%', value: 911 },
+ { label: '9%', value: 900 },
+ { label: '10%', value: 890 },
+ { label: '11%', value: 876 },
+ { label: '12%', value: 863 },
+ { label: '13%', value: 848 },
+ { label: '14%', value: 834 },
+ { label: '15%', value: 821 },
];
export const analogScheme = {