Remove a potentially disasterous confusion between bits and bytes.
(Thanks jepler) Signed-off-by: andy pugh <andy@bodgesoc.org>
This commit is contained in:
parent
5ab9bb90d7
commit
a1a347d14a
1 changed files with 2 additions and 2 deletions
|
|
@ -1334,10 +1334,10 @@ void hm2_sserial_prepare_tram_write(hostmot2_t *hm2, long period){
|
||||||
case LBP_FLOAT:
|
case LBP_FLOAT:
|
||||||
if (conf->DataLength == sizeof(float) * 8 ){
|
if (conf->DataLength == sizeof(float) * 8 ){
|
||||||
float temp = *pin->float_pin;
|
float temp = *pin->float_pin;
|
||||||
memcpy(&buff, &temp, conf->DataLength);
|
memcpy(&buff, &temp, sizeof(float));
|
||||||
} else if (conf->DataLength == sizeof(double) * 8){
|
} else if (conf->DataLength == sizeof(double) * 8){
|
||||||
double temp = *pin->float_pin;
|
double temp = *pin->float_pin;
|
||||||
memcpy(&buff, &temp, conf->DataLength);
|
memcpy(&buff, &temp, sizeof(double));
|
||||||
} else {
|
} else {
|
||||||
HM2_ERR_NO_LL("sserial write: LBP_FLOAT of bit-length %i not handled\n", conf->DataLength);
|
HM2_ERR_NO_LL("sserial write: LBP_FLOAT of bit-length %i not handled\n", conf->DataLength);
|
||||||
conf->DataType = 0; // only warn once, then ignore
|
conf->DataType = 0; // only warn once, then ignore
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue