@@ -135,13 +135,14 @@ void initConfig()
135
135
setConfig (64 , 5 );
136
136
setConfig (65 , 6 );
137
137
setConfig (66 , 2 );
138
- EEPROM.write (4090 , 69 );
138
+ setConfig (67 , 1.00 );
139
+ EEPROM.put (4090 , 69 );
139
140
Serial.println (" Virgin init" );
140
141
}
141
142
else
142
143
{
143
144
int features[] = {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 };
144
- int config[] = {50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 59 , 60 , 62 , 63 , 64 , 65 , 66 };
145
+ int config[] = {50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 59 , 60 , 62 , 63 , 64 , 65 , 66 , 67 };
145
146
int configF[] = {58 , 61 };
146
147
147
148
for (int i = 0 ; i < sizeof features / sizeof features[0 ]; i++)
@@ -159,7 +160,8 @@ void initConfig()
159
160
for (int i = 0 ; i < sizeof configF / sizeof configF[0 ]; i++)
160
161
{
161
162
asset = configF[i] * 10 ;
162
- float configVal = EEPROM.read (asset);
163
+ float configVal;
164
+ EEPROM.get (asset, configVal);
163
165
setConfigFloat (configF[i], configVal);
164
166
}
165
167
}
@@ -273,21 +275,17 @@ void getFeatures()
273
275
void setFeatures (int asset, int value)
274
276
{
275
277
lastActiveConfig = millis ();
276
- if (debugEnabled)
277
- {
278
- Serial.print (" Setting feature: " );
279
- Serial.print (asset);
280
- Serial.print (" :" );
281
- Serial.println (value);
282
- }
283
278
if (asset > 0 && asset < 40 )
284
279
{
285
- int assetLocation = asset * 10 ;
286
- int assetRead = EEPROM.read (assetLocation);
287
- if (assetRead != value)
280
+ if (debugEnabled)
288
281
{
289
- EEPROM.write (assetLocation, value);
282
+ Serial.print (" Setting feature: " );
283
+ Serial.print (asset);
284
+ Serial.print (" :" );
285
+ Serial.println (value);
290
286
}
287
+ int assetLocation = asset * 10 ;
288
+ EEPROM.put (assetLocation, value);
291
289
}
292
290
293
291
switch (asset)
@@ -364,21 +362,18 @@ void setFeatures(int asset, int value)
364
362
void setConfigFloat (int asset, float value)
365
363
{
366
364
lastActiveConfig = millis ();
367
- if (debugEnabled)
368
- {
369
- Serial.print (" Setting configF: " );
370
- Serial.print (asset);
371
- Serial.print (" :" );
372
- Serial.println (value);
373
- }
365
+
374
366
if (asset > 49 && asset < 70 )
375
367
{
376
- int assetLocation = asset * 10 ;
377
- float assetRead = EEPROM.read (assetLocation);
378
- if (assetRead != value)
368
+ if (debugEnabled)
379
369
{
380
- EEPROM.write (assetLocation, fvalue);
370
+ Serial.print (" Setting configF: " );
371
+ Serial.print (asset);
372
+ Serial.print (" :" );
373
+ Serial.println (value);
381
374
}
375
+ int assetLocation = asset * 10 ;
376
+ EEPROM.put (assetLocation, value);
382
377
}
383
378
384
379
switch (asset)
@@ -399,21 +394,18 @@ void setConfigFloat(int asset, float value)
399
394
void setConfig (int asset, int value)
400
395
{
401
396
lastActiveConfig = millis ();
402
- if (debugEnabled)
403
- {
404
- Serial.print (" Setting config: " );
405
- Serial.print (asset);
406
- Serial.print (" :" );
407
- Serial.println (value);
408
- }
397
+
409
398
if (asset > 49 && asset < 70 )
410
399
{
411
- int assetLocation = asset * 10 ;
412
- int assetRead = EEPROM.read (assetLocation);
413
- if (assetRead != value)
400
+ if (debugEnabled)
414
401
{
415
- EEPROM.write (assetLocation, value);
402
+ Serial.print (" Setting config: " );
403
+ Serial.print (asset);
404
+ Serial.print (" :" );
405
+ Serial.println (value);
416
406
}
407
+ int assetLocation = asset * 10 ;
408
+ EEPROM.put (assetLocation, value);
417
409
}
418
410
419
411
switch (asset)
@@ -463,7 +455,9 @@ void setConfig(int asset, int value)
463
455
case 66 :
464
456
config.tpsAgre = value;
465
457
break ;
466
-
458
+ case 67 :
459
+ config.transSloppy = value;
460
+ break ;
467
461
default :
468
462
break ;
469
463
}
@@ -526,7 +520,10 @@ void getConfig()
526
520
Serial.print (config.triggerWheelTeeth );
527
521
Serial.print (" ;" );
528
522
Serial.print (" 66:" );
529
- Serial.println (config.tpsAgre );
523
+ Serial.print (config.tpsAgre );
524
+ Serial.print (" ;" );
525
+ Serial.print (" 67:" );
526
+ Serial.println (config.transSloppy );
530
527
}
531
528
532
529
void serialConfig ()
0 commit comments