Commit 12e5dc87 authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper

Fix floats printing as ints

parent 01c302af
......@@ -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
......
......@@ -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;
}
......
......@@ -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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment