POLLING BITS SPI FLASH

Hi,ime having trouble getting some poart of code to work,my project compiles but the led in my project should flash when the spi flash is busy erasing,it just doesnt work,the code should be fine as the binary for the project works,it was compiled with platformio.but when i copile the sourc code my self with arduino it compiles but the led doesnt flash when it should.any ideas.

Hear is the function its just after bulk erase. flash.isBusy should return a bool 1 in the library function for that function.

void factoryReset() {
WiFi.mode(WIFI_OFF);
delay(100);

Serial.println(“Clearing configuration and rebooting”);
EEPROM.begin(EEPROM_SIZE); //IMPORTANT: Use EEPROM_SIZE or EEPROM will be cleared down to this parameter
for (int i=0; i<EEPROM_SIZE; i++) {
EEPROM.write(i,0xff);
}
EEPROM.end();

flash.bulkErase(); //Clear the entire flash chip

int flip = 0;
while(flash.isBusy()) {
digitalWrite(BUTTON_LED,flip++ % 2);
delay(50);
}

ESP.eraseConfig();
ESP.reset();
}

/////////////hear is the function from the flash library/////////////////////////

byte M25PXFlashMemory::readStatus() {
spi.select();
spi.transfer(READ_STATUS_REGISTER);
byte status = spi.transfer(0);
spi.deselect();
return status;
}

bool M25PXFlashMemory::isBusy() { // hear is the function!!!
return readStatus() & (1 << 0); //LSB is WIP
}

It reads the status register and when the flash is busy it should return a 1 thus flashing the led.
Wip means write in progress.

Please use code tags.

Please post the complete code. The problem is likely to be in the code you didn’t post.