Subversion Repositories NaviCtrl

Rev

Rev 171 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 171 Rev 210
Line 52... Line 52...
52
// +  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52
// +  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
54
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
// +  POSSIBILITY OF SUCH DAMAGE.
55
// +  POSSIBILITY OF SUCH DAMAGE.
56
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
57
#include <ctype.h>
57
#include <stdio.h>
58
#include <stdio.h>
58
#include <stdlib.h>
59
#include <stdlib.h>
59
#include <string.h>
60
#include <string.h>
60
#include "91x_lib.h"
61
#include "91x_lib.h"
61
#include "fat16.h"
62
#include "fat16.h"
Line 74... Line 75...
74
} __attribute__((packed)) Parameter_t;
75
} __attribute__((packed)) Parameter_t;
Line 75... Line 76...
75
 
76
 
76
Parameter_t CFG_Parameter[] =
77
Parameter_t CFG_Parameter[] =
77
{
78
{
78
  //{PID             , "1234567890123456" , Group, Value, Default,   Min,       Max },
79
  //{PID             , "1234567890123456" , Group, Value, Default,   Min,       Max },
79
        {PID_KML_LOGGING , "KMLLogging      " ,     1,   500,     500,    0,    60000}, // the log interval for KML logging, 0 = off
80
        {PID_KML_LOGGING , "KMLLOGGING      " ,     1,   500,     500,    0,    60000}, // the log interval for KML logging, 0 = off
80
        {PID_GPX_LOGGING , "GPXLogging      " ,     1,     0,       0,    0,    60000}   // the log interval for GPX logging, 0 = off
81
        {PID_GPX_LOGGING , "GPXLOGGING      " ,     1,     0,       0,    0,    60000}   // the log interval for GPX logging, 0 = off
Line 81... Line 82...
81
};
82
};
82
 
83
 
Line 139... Line 140...
139
        #define LINE_MAX 32
140
        #define LINE_MAX 32
140
        File_t *fp;
141
        File_t *fp;
141
        s8 settingsline[LINE_MAX];
142
        s8 settingsline[LINE_MAX];
142
        s8 *name, *value;
143
        s8 *name, *value;
143
        u8 i;
144
        u8 i;
-
 
145
        s8 filename[] = "settings.ini";
Line 144... Line 146...
144
 
146
 
145
        UART1_PutString("\n\r Settings init...");
147
        UART1_PutString("\n\r Settings init...");
Line 146... Line 148...
146
        Settings_SetDefaultValues();
148
        Settings_SetDefaultValues();
147
 
149
 
148
        if(Fat16_IsValid())
150
        if(Fat16_IsValid())
149
        {       // check if settings file is existing
151
        {       // check if settings file is existing
150
                if(fexist_("settings.ini"))
152
                if(fexist_(filename))
151
                {
153
                {
152
                        fp = fopen_("settings.ini", 'r');               // try to open the file
154
                        fp = fopen_(filename, 'r');             // try to open the file
153
                        if (fp == NULL)                                                 // could not open the file
155
                        if (fp == NULL)                                                 // could not open the file
154
                        {
156
                        {
155
                                UART1_PutString("ERROR: Opening settings file!");
157
                                UART1_PutString("ERROR: Opening settings file!");
Line 168... Line 170...
168
                                {
170
                                {
169
                                        name  = strtok(settingsline, "="); // get name
171
                                        name  = strtok(settingsline, "="); // get name
170
                                        value = strtok(NULL, "="); // get value
172
                                        value = strtok(NULL, "="); // get value
171
                                        if ((name != NULL) && (value != NULL))
173
                                        if ((name != NULL) && (value != NULL))
172
                                        {
174
                                        {
-
 
175
                                                u8 i;
-
 
176
                                                for(i=0; name[i]; i++) name[i] = toupper(name[i]);
173
                                                Settings_SetParameterFromString(name, value);
177
                                                Settings_SetParameterFromString(name, value);
174
                                        }
178
                                        }
175
                                }
179
                                }
176
                        }
180
                        }
177
                        fclose_(fp);
181
                        fclose_(fp);