Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed CROTUS_XBee mbed-rtos Crotus_Com
Diff: Magneto.cpp
- Revision:
- 5:8142f455454b
- Parent:
- 1:3591e7df4ff4
- Child:
- 6:2605aa78ef9f
--- a/Magneto.cpp Mon Apr 03 12:17:55 2017 +0000 +++ b/Magneto.cpp Mon Apr 03 18:55:55 2017 +0000 @@ -8,10 +8,17 @@ Ticker calibrationTicker; + /* int16_t minX = OR_MAX_VALUE; // The maximum value is put in the min so real values will always be smaller int16_t maxX = OR_MIN_VALUE; // The minimum value is put in the max so real values will always be bigger int16_t minY = OR_MAX_VALUE; // The maximum value is put in the min so real values will always be smaller int16_t maxY = OR_MIN_VALUE; // The minimum value is put in the max so real values will always be bigger + */ + + int16_t minX = 0xFFA0; + int16_t maxX = 0x01DD; + int16_t minY = 0xFD95; + int16_t maxY = 0x0054; int16_t offsetX = 0; int16_t offsetY = 0; @@ -53,7 +60,7 @@ } } - LocalFileSystem local("local"); + /*LocalFileSystem local("local"); void _LoadCalibration(){ FILE *fp = fopen("/local/magneto.cfg", "r"); @@ -73,16 +80,17 @@ FILE *fp = fopen("/local/magneto.cfg", "w"); fprintf(fp, "%04X %04X %04X %04X", minX & 0xFFFF, maxX & 0xFFFF, minY & 0xFFFF, maxY & 0xFFFF); fclose(fp); - } + }*/ }; Magneto::Magneto(I2C & i2c) : _i2c(&i2c) { - _LoadCalibration(); + //_LoadCalibration(); // Every 10 minutes - calibrationTicker.attach(_SaveCalibration, 600); + //calibrationTicker.attach(_SaveCalibration, 15); + _UpdateScaleAndOffset(); } bool Magneto::TestDeviceConnection(){