Electron not receiving new firmware from Web IDE

I am unable to flash new firmware to my Electron. The IDE will at times indicate that the flash was successful, however, the electron does not flash magenta and I know for a fact that it is running an older program. I checked that the IDE version is compatible with the device (0.4.8). I also tried to upload the blink program and even though it stated that the flash was successful the electron was still running the older program. I also attempted to reset the electron but it did not seem to work. Below is a copy of my code:

//The following program receives data values from sensors and transmits values to the cloud 


float turbidityValue = 0.0;
float orpValue = 0.0; 
String orpValueString = ""; 
float phValue = 0.0; 
String phValueString = "";
float ecValue = 0.0; 
String ecValueString = ""; 

void setup() {
    //for turbidity sensor
    pinMode(A0, INPUT);
    
    //for ORP, pH, and EC sensors
    pinMode(D2, OUTPUT);
    pinMode(D3, OUTPUT); 
    Serial.begin(9600);
    Serial1.begin(9600); 
    
    //orpValueString.reserve(30);
    //phValueString.reserve(30);
    //ecValueString.reserve(30); 
 
}

void loop() {
    
    turbidityValue = getTurbidityValue();
    orpValue = getORPValue(); 
    phValue = getpHValue(); 
    ecValue = getECValue(); 
    
    Particle.publish("turbidity",String(turbidityValue));
    Particle.publish("ORP", String(orpValue)); 
    //Particle.publish("pH", String(phValue));  
    //Particle.publish("EC", String(ecValue)); 
    Particle.publish("version", "2.0"); 
    
    delay(1000);

   
}

float getORPValue(){
    
    float value = 0.0;

    //y value
    digitalWrite(D2, LOW);
    //x value
    digitalWrite(D3, LOW); 
    Serial1.print("r\r");
    delay(100);
    orpValueString = Serial1.readStringUntil('\r');
    value = atof(orpValueString);
    
    return value; 
}

float getpHValue(){
    
    float value = 0.0;
    
    //y value
    digitalWrite(D2, HIGH);
    //x value
    digitalWrite(D3, LOW);
    Serial1.flush(); 
    Serial1.print("r\r");
    delay(100);
    phValueString = Serial1.readStringUntil('\r');
    value = atof(phValueString);
   
    return value;
}

float getECValue(){
    
    float value = 0.0;
    //y value
    digitalWrite(D2, LOW);
    //x value
    digitalWrite(D3, HIGH);
    Serial1.flush();
    Serial1.print("r\r");
    delay(100);
    ecValueString = Serial1.readStringUntil('\r');
    value = atof(ecValueString); 
    
    return value; 
}

float getTurbidityValue(){
    
    int sensorTurbidityValue = 0;
    float voltage = 0.0; 
    
    sensorTurbidityValue = analogRead(A0);
    voltage = sensorTurbidityValue * (5.0 / 1024.0);
    
    return voltage; 
}

Have you tried safe mode?
Also, you’re crossing the publish limit, which you should probably take another look at.

I just about always put my Electon’s in Safe Mode when flashing new firmware OTA.

Thank you! Safe mode worked!
I will look into the publishing limit…thank you for pointing it out