I need help with a project (using stepper motor rotate 45 degrees)

I'm trying to make a project that involves rotating a stepper motor 45 degrees with a button in the app, but it's not working for me and I don't understand how to fix it.

this is the code:

#include <AccelStepper.h>
#define motorInterfaceType 8
AccelStepper stepper(motorInterfaceType, 19, 18, 5, 17);

#include <BluetoothSerial.h>
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  SerialBT.begin("ESP32_Stepper"); //
  
  stepper.setMaxSpeed(1000);
  stepper.setAcceleration(500);
}

void loop() {
  if (SerialBT.available()) {
    char cmd = SerialBT.read();
    if(cmd == 'R') {
      stepper.move(256); // 45°
      while(stepper.distanceToGo() != 0) {
        stepper.run();
      }
    }
  }
}

Your Else clause in the turn45 button does not make sense.

If BlueTooth is not connected, announcing it to the Bluetooth device would not reach it.

Use a Notifier instead, for the benefit of the app user.
I like the Notifier block with the OK button, so the message persists until it is cleared by the user.

If that does not help, look for a Bluetooth terminal app in the Play Store, and use that to test your device independently of your AI2 app.