- small improvements in drivers
This commit is contained in:
15
oxinst.c
15
oxinst.c
@ -11,6 +11,7 @@ is not changed, i.e. an existing errCode is not overwritten.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -160,13 +161,15 @@ double OxiGet(EaseBase *eab, int dig, int *pdig, double old) {
|
||||
|
||||
void OxiSet(EaseBase *eab, char *cmd, double val, int dig) {
|
||||
char buf[64];
|
||||
int l;
|
||||
|
||||
if (eab->syntax <= 0) {
|
||||
snprintf(buf, sizeof(buf), "%s%.*f", cmd, dig, val);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "%s%f", cmd, val);
|
||||
double f;
|
||||
|
||||
if (eab->syntax > 0) {
|
||||
f = fabs(val);
|
||||
if (f < 1.0) f = 1.0;
|
||||
dig = 5 - log10(f);
|
||||
if (dig < 0) dig = 0;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s%.*f", cmd, dig, val);
|
||||
EaseWrite(eab, buf);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user