Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SACADA
sacada-mini-firmware
Commits
12e5dc87
Commit
12e5dc87
authored
Jul 18, 2019
by
Pedro Henrique Kopper
Browse files
Fix floats printing as ints
parent
01c302af
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/libscpi/scpi/config.h
View file @
12e5dc87
...
...
@@ -61,8 +61,8 @@ extern "C" {
* Detect, if it has limited resources or it is running on a full blown operating system.
* All values can be overiden by scpi_user_config.h
*/
#define SYSTEM_BARE_METAL
0
#define SYSTEM_FULL_BLOWN
1
#define SYSTEM_BARE_METAL
1
#define SYSTEM_FULL_BLOWN
0
/* This should cover all windows compilers (msvc, mingw, cvi) and all Linux/OSX/BSD and other UNIX compatible systems (gcc, clang) */
#if defined(_WIN32) || defined(_WIN64) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
...
...
@@ -115,7 +115,7 @@ extern "C" {
#endif
#ifndef USE_CUSTOM_DTOSTRE
#define USE_CUSTOM_DTOSTRE
0
#define USE_CUSTOM_DTOSTRE
1
#endif
#ifndef USE_UNITS_IMPERIAL
...
...
threads/comm.c
View file @
12e5dc87
...
...
@@ -54,9 +54,9 @@ static scpi_result_t scpi_measure_voltage(scpi_t * context) {
if
(
!
SCPI_ParamChoice
(
context
,
trigger_source
,
&
param
,
TRUE
))
{
return
SCPI_RES_ERR
;
}
float
reading
=
(
float
)
chMsgSend
(
chRegFindThreadByName
(
"sensors"
),
(
msg_t
)
param
);
float
*
reading
=
(
float
*
)
chMsgSend
(
chRegFindThreadByName
(
"sensors"
),
(
msg_t
)
param
);
SCPI_ResultDouble
(
context
,
reading
);
SCPI_ResultDouble
(
context
,
*
reading
);
return
SCPI_RES_OK
;
}
...
...
threads/sensors.c
View file @
12e5dc87
...
...
@@ -69,6 +69,6 @@ THD_FUNCTION(Sensors, arg) {
float
volts
=
ads1115ReadMillivolts
(
&
ADS1115
,
0
);
sprintf
(
buf
,
"Volts: %d.%d"
,
(
int
)
volts
,
(
int
)
((
volts
-
((
int
)
volts
))
*
100
));
(
void
)
chMsgSend
(
chRegFindThreadByName
(
"display"
),
(
msg_t
)
buf
);
chMsgRelease
(
tp
,
(
msg_t
)
volts
);
chMsgRelease
(
tp
,
(
msg_t
)
&
volts
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment