Subversion Repositories FlightCtrl

Rev

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

Rev 2116 Rev 2122
Line 142... Line 142...
142
      IMUConfig_writeToEEprom();
142
      IMUConfig_writeToEEprom();
143
    }
143
    }
144
}
144
}
Line 145... Line 145...
145
 
145
 
146
/***************************************************/
146
/***************************************************/
147
/* ChannelMap                                      */
147
/* ChannelMap and R/C trim                         */
148
/***************************************************/
148
/***************************************************/
149
void channelMap_writeToEEProm(void) {
149
void channelMap_writeToEEProm(void) {
150
  writeChecksummedBlock(CHANNELMAP_REVISION, (uint8_t*)&channelMap, EEPROM_ADR_CHANNELMAP, sizeof(ChannelMap_t));
150
  writeChecksummedBlock(CHANNELMAP_REVISION, (uint8_t*)&channelMap, EEPROM_ADR_CHANNELMAP, sizeof(ChannelMap_t));
Line 151... Line 151...
151
}
151
}
152
 
152
 
153
void channelMap_readOrDefault(void) {
153
void channelMap_readOrDefault(void) {
154
  if (readChecksummedBlock(CHANNELMAP_REVISION, (uint8_t*)&channelMap, EEPROM_ADR_CHANNELMAP, sizeof(ChannelMap_t))) {
154
  if (readChecksummedBlock(CHANNELMAP_REVISION, (uint8_t*)&channelMap, EEPROM_ADR_CHANNELMAP, sizeof(ChannelMap_t))) {
155
    printf("\n\rwriting default channel map");
155
    printf("\n\rwriting default channel map");
-
 
156
    channelMap_default();
156
    channelMap_default();
157
    channelMap_writeToEEProm();
157
    channelMap_writeToEEProm();
158
    // For whatever stupid reason, the newly defaulted channel map is not used! Reset.
158
        wdt_enable(WDTO_500MS);
159
        wdt_enable(WDTO_500MS);
Line -... Line 160...
-
 
160
  }
-
 
161
}
-
 
162
 
-
 
163
void rcTrim_writeToEEProm(void) {
-
 
164
  writeChecksummedBlock(0, (uint8_t*)&rcTrim, EEPROM_ADR_RCTRIM, sizeof(RCTrim_t));
-
 
165
}
-
 
166
 
-
 
167
void rcTrim_readOrDefault(void) {
-
 
168
  if (readChecksummedBlock(0, (uint8_t*)&rcTrim, EEPROM_ADR_RCTRIM, sizeof(RCTrim_t))) {
-
 
169
    printf("\n\rwriting zero RC trim");
-
 
170
    RC_setZeroTrim();
-
 
171
    rcTrim_writeToEEProm();
159
  }
172
  }
160
}
173
}
161
 
174
 
162
/***************************************************/
175
/***************************************************/
163
/* Sensor offsets                                  */
176
/* Sensor offsets                                  */