void GeogramONE::configureInterval(uint32_t *smsInterval, uint32_t *sleepTimeOn, uint32_t *sleepTimeOff, uint8_t *sleepTimeConfig, uint32_t *gprsInterval) { EEPROM_readAnything(SMSSENDINTERVAL,*smsInterval); EEPROM_readAnything(SLEEPTIMEON,*sleepTimeOn); EEPROM_readAnything(SLEEPTIMEOFF,*sleepTimeOff); EEPROM_readAnything(SLEEPTIMECONFIG,*sleepTimeConfig); EEPROM_readAnything(UDPSENDINTERVAL,*gprsInterval); return; }
void loadSettingsFromEEPROM( void ) { //future, add validity checking? //but since it's all booleans, not ints, we'll survive! EEPROM_readAnything(EEPROM_SETTINGS_ADDRESS, *SETTINGS); //printOutUserSettings(); EEPROM_readAnything(EEPROM_USERSTRING_ADDRESS, UserString); verifyAndCorrectSettings(); }
void GeogramONE::configureSpeed(uint8_t *cmd3, uint8_t *speedH, uint16_t *speedL) { EEPROM_readAnything(SPEEDLIMIT,*speedL); EEPROM_readAnything(SPEEDHYST,*speedH); if(*speedL) *cmd3 = 0x02; else *cmd3 = 0x00; }
void GeogramONE::configureFence(uint8_t fenceNumber, geoFence *fence) { uint8_t offset = 0; if(fenceNumber == 2) offset += 14; if(fenceNumber == 3) offset += 28; EEPROM_readAnything((INOUT1 + offset), fence->inOut); EEPROM_readAnything((RADIUS1 + offset), fence->radius); EEPROM_readAnything((LATITUDE1 + offset), fence->latitude); EEPROM_readAnything((LONGITUDE1 + offset), fence->longitude); return ; }
void FreeboardModel::readConfig() { //check versions here int ver; EEPROM_readAnything(0, ver); if (ver != version) { //save a default config, since we cant read the old one safely saveConfig(); } //now we know its compatible EEPROM_readAnything(EEPROM_DATA, config); }
void FreeBoardModel::readConfig() { //check versions here int ver; EEPROM_readAnything(0, ver); if (ver != version) { //do any conversion of old data here //save saveConfig(); } //now we know its compatible EEPROM_readAnything(EEPROM_VER, config); }
void RadioMMI::begin(LCD* lcd, Encoder* encoder, int ditPin, int dahPin) { mLcd = lcd; mEncoder = encoder; mDitPin = ditPin; mDahPin = dahPin; pinMode(ditPin, INPUT); // set pin to input digitalWrite(ditPin, HIGH); // turn on pullup resistors pinMode(dahPin, INPUT); // set pin to input digitalWrite(dahPin, HIGH); // turn on pullup resistors pinMode(BUTTON_PIN, INPUT); // set pin to input digitalWrite(BUTTON_PIN, HIGH); // turn on pullup resistors mIsPaddleConnected = digitalRead(ditPin); mUpdate = true; mMMIState = CHANGE_FREQ; mEncoderPosition = encoder->read(); // Read presisted values EEPROM_readAnything(0, mStore); // Set defaults if (mStore.first != 666) { mStore.first = 666; mStore.freq = 7000000; mStore.step = 100; } }
void SabreController::readInputConfiguration() { int location = 0; for (uint8_t i = 0; i < NUMBER_OF_INPUTS; i++) { location += EEPROM_readAnything(location, this->Config[i]); } }
void edit_waypoint(){ while(1){ display_waypoints(); SERIAL_OUT.println(); SERIAL_OUT.print("Edit wp #? "); int i = SERIAL_OUT.parseInt(); EEPROM_readAnything(i*WP_SIZE, waypoint); SERIAL_OUT.println(); SERIAL_OUT.print("current values: "); SERIAL_OUT.print(waypoint.x); SERIAL_OUT.print(" , "); SERIAL_OUT.println(waypoint.y); SERIAL_OUT.println(); SERIAL_OUT.print("enter new coordinates \"x , y\": "); int x_temp = SERIAL_OUT.parseInt(); int y_temp = SERIAL_OUT.parseInt(); SERIAL_OUT.println(); SERIAL_OUT.print("current values: "); SERIAL_OUT.print(waypoint.x); SERIAL_OUT.print(" , "); SERIAL_OUT.println(waypoint.y); SERIAL_OUT.print("new values: "); SERIAL_OUT.print(x_temp); SERIAL_OUT.print(" , "); SERIAL_OUT.println(y_temp); while(1){ SERIAL_OUT.print("accept values (y=1, n=0)? "); int y_or_n = SERIAL_OUT.parseInt(); if(y_or_n == 1){ waypoint.x = float(x_temp); waypoint.y = float(y_temp); EEPROM_writeAnything(i*WP_SIZE, waypoint); SERIAL_OUT.println(); SERIAL_OUT.println("waypoint changed"); break; } else if(y_or_n == 0){ SERIAL_OUT.println("no change made"); break; } else SERIAL_OUT.println("invalid. try again"); } SERIAL_OUT.println(); SERIAL_OUT.print("edit another waypoint (y=1, n=0)? "); int n_or_y = SERIAL_OUT.parseInt(); if(n_or_y == 1) ; else break; } SERIAL_OUT.println(); return ; }
void GeogramONE::getFenceActive(uint8_t fenceNumber, uint8_t *fenceVar) { uint8_t offset = 0; if(fenceNumber == 2) offset += 14; if(fenceNumber == 3) offset += 28; EEPROM_readAnything(ACTIVE1 + offset,*fenceVar); return ; }
void Keychain::PrepKeys() { //Check whether a keychain is available bool KeychainExists = false; EEPROM_readAnything(KEYCHAIN_EXISTS_IN_EEPROM_FLAG_ADDRESS, KeychainExists); if(KeychainExists) LoadKeychain(); //Load the Keychain from the EEPROM else PopulateKeychain(); //Populate a new Keychain and store it to the EEPROM }
void setup() { lcd.print("LOADING"); lcd.begin(20, 4); sensorManager.init(); initButtons(); Serial.begin(9600); setSyncProvider(RTC.get); EEPROM_readAnything(0, altitude); }
void f_systemBootSetup() { assert(f_systemBootWifiConnected_p != NULL); #ifdef DEBUG Serial.begin(115200); #endif EEPROM.begin(512); delay(10); #if defined(D_BOOT_EEPROM_ERASE) DEBUG_PRINTLN("clearing eeprom"); for (unsigned int i = 0; i < EEPROM_ADDR_END; ++i) { EEPROM.write(i, 0); } EEPROM.commit(); #endif DEBUG_PRINTLN(); DEBUG_PRINTLN(); DEBUG_PRINTLN("Startup"); // read eeprom for ssid and pass DEBUG_PRINTLN("Reading EEPROM ssid"); EEPROM_readAnything(EEPROM_ADDR_CONFIGURATION, *gProductConfig_p); if (gProductConfig_p->check_virgin!=CHECK_VIRGIN_VALUE) // virgin CONFIG, expected [0x55] { DEBUG_PRINTLN("No valid config found in EEPROM, loading defaults"); memset(gProductConfig_p, 0, sizeof(*gProductConfig_p)); } else { DEBUG_PRINT("SSID: "); DEBUG_PRINTLN(gProductConfig_p->router_ssid); DEBUG_PRINT("PASS: "); DEBUG_PRINTLN(gProductConfig_p->router_passwd); } if ( strlen(gProductConfig_p->router_ssid) > 1 ) { // test esid WiFi.mode(WIFI_STA); WiFi.begin(gProductConfig_p->router_ssid, gProductConfig_p->router_passwd); if ( f_systemBootTestWifi() == 20 ) { f_systemBootWifiConnected_p(); return; } } f_systemBootSetupAP(WIFI_STA); }
//PROGRAM FUNCTIONS void update_waypoint(){ //waypoint acceptance and move to next waypoint if(proximity < (WAYPOINT_ACCEPT)){ x_wp0 = x_wp; y_wp0 = y_wp; wpr_count++; EEPROM_readAnything(wpr_count*WP_SIZE, waypoint); x_wp = waypoint.x; y_wp = waypoint.y; SERIAL_OUT.print("read WP #"); SERIAL_OUT.print(wpr_count); SERIAL_OUT.print(": "); SERIAL_OUT.print(x_wp); SERIAL_OUT.print(" , "); SERIAL_OUT.println(y_wp); double temp = pow((x_wp-x),2); temp += pow((y_wp-y),2); proximity = sqrt(temp); //proximity = sqrt(pow((x_wp - x),2) + pow((y_wp - y),2)); previous_proximity = proximity; } return ; }
void display_waypoints(){ SERIAL_OUT.println(); for(int i=1; i <= WAYPOINT_COUNT; i++){ EEPROM_readAnything(i*WP_SIZE, waypoint); Serial.print(i); Serial.print(": "); Serial.print(waypoint.x); Serial.print(" , "); Serial.println(waypoint.y); Serial2.print("#"); Serial2.print(i); Serial2.print(","); Serial2.print(waypoint.x); Serial2.print(","); Serial2.println(waypoint.y); } SERIAL_OUT.println(); return ; }
void initSettings() { (void) EEPROM_readAnything(4, settings); }
void setup() { Tlc.init(); Tlc.update(); Uart.begin(57000); colors[0][0] = 255; // red colors[0][1] = 0; colors[0][2] = 0; colors[1][0] = 255;// orange colors[1][1] = 30; colors[1][2] = 0; colors[2][0] = 255;// yellow colors[2][1] = 75; colors[2][2] = 0; colors[3][0] = 0;// green colors[3][1] = 255; colors[3][2] = 0; colors[4][0] = 0;// aqua colors[4][1] = 255; colors[4][2] = 255; colors[5][0] = 0;// blue colors[5][1] = 0; colors[5][2] = 255; colors[6][0] = 100;// indigo colors[6][1] = 0; colors[6][2] = 255; colors[7][0] = 180;// violet colors[7][1] = 0; colors[7][2] = 255; usa[0][0] = 255; // Red usa[0][1] = 0; usa[0][2] = 0; usa[1][0] = 255; // White usa[1][1] = 255; usa[1][2] = 100; usa[2][0] = 0; // Blue usa[2][1] = 0; usa[2][2] = 255; ms[0] = 0; ms[1] = 0; ms[2] = 0; ms[3] = 0; ms[4] = 0; states[0] = 0; states[1] = 0; states[2] = 0; states[3] = 0; states[4] = 0; rows[0] = 0; rows[1] = 0; rows[2] = 0; rows[3] = 0; rows[4] = 0; ufos[0] = 0; ufos[1] = 3; ufos[2] = 6; ufos[3] = 9; ufos[4] = 12; i = 0; // JUST ADDED!!! EEPROM_readAnything(0, configuration); }
void read_waypoint(){ //CLEAR EEPROM_readAnything(wpr_count*WP_SIZE, waypoint); return ; }
//Load a stored keymap into the Keys array void Keychain::LoadKeychain() { EEPROM_readAnything(KEYCHAIN_EEPROM_START_ADDRESS, Keys); }
void manageROM::readConfiguration(void) { EEPROM_readAnything(0, configuration); }
void GeogramONE::configureBreachParameters(uint8_t *breachSpeed, uint8_t *breachReps) { EEPROM_readAnything(BREACHSPEED, breachSpeed); EEPROM_readAnything(BREACHREPS, breachReps); }
void EEPROM_RetrieveSettings(bool def, bool printout) { // if def=true, the default values will be used int i=EEPROM_OFFSET; char stored_ver[4]; char ver[4]=EEPROM_VERSION; unsigned long ul_help = 0; EEPROM_readAnything(i,stored_ver); //read stored version if ((!def)&&(strncmp(ver,stored_ver,3)==0)) { // version number match EEPROM_readAnything(i,axis_steps_per_unit); EEPROM_readAnything(i,max_feedrate); EEPROM_readAnything(i,max_acceleration_units_per_sq_second); EEPROM_readAnything(i,move_acceleration); EEPROM_readAnything(i,retract_acceleration); EEPROM_readAnything(i,minimumfeedrate); EEPROM_readAnything(i,mintravelfeedrate); EEPROM_readAnything(i,ul_help); //min Segmenttime --> not used yet EEPROM_readAnything(i,max_xy_jerk); EEPROM_readAnything(i,max_z_jerk); unsigned int Kp,Ki,Kd; EEPROM_readAnything(i,Kp); EEPROM_readAnything(i,Ki); EEPROM_readAnything(i,Kd); showString(PSTR("Stored settings retreived\r\n")); } else { float tmp1[]=_AXIS_STEP_PER_UNIT; float tmp2[]=_MAX_FEEDRATE; long tmp3[]=_MAX_ACCELERATION_UNITS_PER_SQ_SECOND; for (short i=0;i<4;i++) { axis_steps_per_unit[i]=tmp1[i]; max_feedrate[i]=tmp2[i]; max_acceleration_units_per_sq_second[i]=tmp3[i]; } move_acceleration=_ACCELERATION; retract_acceleration=_RETRACT_ACCELERATION; minimumfeedrate=DEFAULT_MINIMUMFEEDRATE; mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE; max_xy_jerk=_MAX_XY_JERK; max_z_jerk=_MAX_Z_JERK; showString(PSTR("Using Default settings\r\n")); } if(printout) { EEPROM_printSettings(); } }
// read all main menu settings from the EEPROM void SabreController::readMainMenuSettings() { EEPROM_readAnything(EEPROM_MENU_SETTINGS, this->MainMenuSettings); }