57,11 → 57,10 |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include "printf_P.h" |
#include "fat16.h" |
#include "settings.h" |
#include "uart0.h" |
#include "uart1.h" |
#include "main.h" |
|
typedef struct |
{ |
117,8 → 116,7 |
// out of range ? |
if((CFG_Parameter[i].Value < CFG_Parameter[i].Min) || (CFG_Parameter[i].Value > CFG_Parameter[i].Max)) |
{ // print a warning |
sprintf(text,"\r\n%s <-- %d is out of range [%d...%d]", string, CFG_Parameter[i].Value, CFG_Parameter[i].Min, CFG_Parameter[i].Max); |
printf(text); |
printf("\r\n%s <-- %d is out of range [%d...%d]", string, CFG_Parameter[i].Value, CFG_Parameter[i].Min, CFG_Parameter[i].Max); |
CFG_Parameter[i].Value = CFG_Parameter[i].Default; // fallback to default |
} |
retval = 1; // value in range |
126,9 → 124,8 |
} |
} |
if(!retval) |
{ |
sprintf(text,"\r\n%s <-- unknown parameter\r\n", string); |
printf(text); |
{ |
printf("\r\n%s <-- unknown parameter\r\n", string); |
} |
return(retval); |
} |
144,13 → 141,13 |
uint8_t i; |
char *tmp; |
|
printf("\n\rSettings init..."); |
printf("\r\nSettings init..."); |
Settings_SetDefaultValues(); |
|
|
if(Fat16_IsValid()) |
{ // check if settings file is existing |
if(fexist_("settings.ini")) |
{ |
{ |
fp = fopen_("settings.ini", 'r'); // try to open the file |
if (fp == NULL) // could not open the file |
{ |
186,7 → 183,7 |
if(fp == NULL) |
{ |
printf("ERROR: Creating default settings file!"); |
return; |
return; |
} |
// run thrue all parameters and set value to default |
for (i = 0; i < sizeof(CFG_Parameter) / sizeof(Parameter_t); i++) |