From: b Date: Tue, 9 Aug 2022 22:29:30 +0000 (+0200) Subject: fix limit check in calculation encoding X-Git-Tag: v1.1 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=staf%2Flibstaf fix limit check in calculation encoding --- diff --git a/libstaf.c b/libstaf.c index fe24457..155ae9b 100644 --- a/libstaf.c +++ b/libstaf.c @@ -1,8 +1,8 @@ -// SilentTimer Action Figure communication library, v1.0 +// SilentTimer Action Figure communication library, v1.1 // libstaf.c // -// 14.12.2020 -// Copyright (C) 2020 Balthasar Szczepański +// 09.08.2022 +// Copyright (C) 2020, 2022 Balthasar Szczepański // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -1230,7 +1230,7 @@ int stafEncodeCalculationArgument (float in, uint8_t *out, uint8_t *flags) return ERR_INVALID_PARAMETER; fraction = in*100.0; - if(fraction>limit) + if(fraction>=limit) bcd = stafEncodeBcdU16((uint16_t)(in+0.5)); else { diff --git a/libstaf.h b/libstaf.h index e094ea0..20ed7e2 100644 --- a/libstaf.h +++ b/libstaf.h @@ -1,5 +1,5 @@ // SilentTimer Action Figure communication library -// libstaf.h, v1.0 +// libstaf.h, v1.1 // // 03.07.2020 // Copyright (C) 2020 Balthasar Szczepański