Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DIOT Monitoring Module
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
DIOT Monitoring Module
Commits
a9cb79cb
Commit
a9cb79cb
authored
3 years ago
by
Christos Gentsos
Browse files
Options
Downloads
Patches
Plain Diff
Main: fix ADC channel scan misalignment
parent
0dea78ea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
main_fw/atmel_start_prj/config/hpl_adc_config.h
+1
-1
1 addition, 1 deletion
main_fw/atmel_start_prj/config/hpl_adc_config.h
main_fw/src/i2c_impl.c
+9
-8
9 additions, 8 deletions
main_fw/src/i2c_impl.c
main_fw/src/main.c
+11
-8
11 additions, 8 deletions
main_fw/src/main.c
with
21 additions
and
17 deletions
main_fw/atmel_start_prj/config/hpl_adc_config.h
+
1
−
1
View file @
a9cb79cb
...
...
@@ -244,7 +244,7 @@
// <id> adc_arch_inputscan
#ifndef CONF_ADC_0_INPUTSCAN
#ifdef MMRTSB
#define CONF_ADC_0_INPUTSCAN 1
8
#define CONF_ADC_0_INPUTSCAN 1
4
#else
#define CONF_ADC_0_INPUTSCAN 11
#endif
...
...
This diff is collapsed.
Click to expand it.
main_fw/src/i2c_impl.c
+
9
−
8
View file @
a9cb79cb
...
...
@@ -43,10 +43,16 @@ void query_prp();
void
query_cln
();
uint8_t
query_r
;
#ifdef MMRTSB
#define MAX_PAGE 3
#else
#define MAX_PAGE 2
#endif
extern
uint16_t
volts_lin
[
MAX_PAGE
+
1
];
extern
uint16_t
currs_lin
[
MAX_PAGE
+
1
];
extern
uint16_t
powrs_lin
[
MAX_PAGE
+
1
];
extern
uint16_t
temps_lin
[
3
];
extern
uint16_t
volts_lin
[
3
];
extern
uint16_t
currs_lin
[
3
];
extern
uint16_t
powrs_lin
[
3
];
extern
uint16_t
frpms_lin
[
3
];
uint32_t
TMR_ERROR_CNT
;
...
...
@@ -193,11 +199,6 @@ void boot_new_fw()
void
__xMR
page_chk
()
{
#ifdef MMRTSB
#define MAX_PAGE 3
#else
#define MAX_PAGE 2
#endif
if
(
page_tmp
>
MAX_PAGE
)
page
=
MAX_PAGE
;
else
...
...
This diff is collapsed.
Click to expand it.
main_fw/src/main.c
+
11
−
8
View file @
a9cb79cb
...
...
@@ -73,12 +73,6 @@ float temp_curve_points_y[3][3] __xMR = {{1000, 2000, 5000}, {1000, 2000, 4000},
float
temp_matrix
[
3
][
3
]
__xMR
=
{{
1
,
0
,
0
},
{
0
,
1
,
0
},
{
1
,
0
,
0
}};
uint16_t
temp_control_on
__xMR
=
0
;
uint16_t
adc_ch
__xMR
;
uint16_t
adc_vals
[
12
];
float
temps
[
3
];
float
volts
[
3
];
float
currs
[
3
];
// V_ref and the readout it corresponds to
#define VREF 2.5
#define ADC_MAX 65535.0
...
...
@@ -87,7 +81,7 @@ float currs[3];
// I[mA] = V_adc * scaling_coeff
// T[degC] = (V_adc + a) * b
#if defined MMRTSB
#define ADC_CH_MAX 1
9
#define ADC_CH_MAX 1
5
// Voltages: P12V, P1V2, P3V3, PPERIPH
const
float
volt_scaling_coeff
[
4
]
=
{(
10
.
0
+
2
.
0
)
/
2
.
0
,
1
.
0
/
(
1
.
0
+
(
1
.
0
/
1
.
0
)),
(
4
.
7
+
10
.
0
)
/
10
.
0
,
(
4
.
7
+
2
.
0
)
/
2
.
0
};
// Current: P12V
...
...
@@ -127,6 +121,12 @@ const float temp_coeff_a[3] = {0, 0, 0};
const
float
temp_coeff_b
[
3
]
=
{
0
,
0
,
0
};
#endif
uint16_t
adc_ch
__xMR
;
uint16_t
adc_vals
[
ADC_CH_MAX
];
float
temps
[
3
];
float
volts
[
4
];
float
currs
[
3
];
uint16_t
trig_adc_next_second
__xMR
=
0
;
#if defined(MMFANT) || defined(MMPROT)
...
...
@@ -321,7 +321,10 @@ void __xMR adc_cb(const struct adc_async_descriptor *const descr, const uint8_t
powrs_lin
[
2
]
=
float_to_linear
(
volts
[
2
]
*
currs
[
2
]);
break
;
#ifdef MMRTSB
case
18
:
case
14
:
volts
[
3
]
=
VREF
*
(
adc_vals
[
adc_ch
]
/
ADC_MAX
)
*
volt_scaling_coeff
[
3
];
volts_lin
[
3
]
=
float_to_linear
(
volts
[
3
]);
powrs_lin
[
3
]
=
float_to_linear
(
0
);
break
;
#endif
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment