- small improvements in drivers

This commit is contained in:
zolliker
2008-05-14 14:23:43 +00:00
parent f10767551e
commit d109dd026a
4 changed files with 158 additions and 30 deletions

View File

@ -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);
}