Progression of my arduino to/from nextion code

With suggestions from other members I have been working on cleaning up my code and utilizing functions as well. Still trying to figure out how to get the data coming in from the nextion to be more reliable. I'd like to put the function call for my page 2 textboxes/button into the setup function so that it only runs on reset because those variables will not change very often. I'm a little confused on how to break up the code I'm using to do that so I will include that as well. Unless someone has a more streamlined way of doing it.

#include <SoftwareSerial.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#include <AccelStepper.h>


#define motorPin1 4
#define motorPin2 6
#define motorPin3 7
#define motorPin4 8
#define HALFSTEP 8
#define ONE_WIRE_BUS 12


OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
SoftwareSerial mySerial(10, 11);


int tps;
int tpsprev;
float O2;
float O2new;
float O2set;
float O2voltage;
int O2heat;
int ets;
const int dataIN = 13;
unsigned long prevmillis;
unsigned long duration;
int rpm;
boolean currentstate;
boolean prevstate;
float enrich;
float accel;
float etsenrich;
float intemp;
const int injpin = 5;
float pw;
int fuelstan;
int reqfuel;
int ve;
int injopen;
float hourmeter;
float minutes;
int oc;
int gc;
String message;
int numMessages;
int numBytes;
int endBytes;
byte inByte;
byte pageNum;
byte buttonNum;


void setup() {
  stepper1.setMaxSpeed(1500);  //THROTTLE STEPPER SETTINGS
  stepper1.setAcceleration(1500);
  pinMode(A0, INPUT);  //O2 SENSOR
  pinMode(dataIN, INPUT);  //IR SENSOR
  prevmillis = 0;  //RPM VARIABLE INITIALIZATION
  prevstate = LOW;
  pinMode(2, OUTPUT);  //INJECTOR
  pinMode(5, OUTPUT);  //START RELAY
  Serial.begin(57600);
  while (!Serial) {
    ;
  }
  Serial.println("Serial On");
  mySerial.begin(9600);  //SCREEN SERIAL
  numMessages, endBytes = 0;
  pageNum, buttonNum = 255;
}


void loop() {
  HMI_display_rpm(rpm);
  HMI_display_ets(ets);
  HMI_display_O2new(O2new);
  HMI_display_minutes(minutes);
  HMI_display_warning_oc();
  HMI_display_warning_gc();
  HOURmeter();
  IRsensor();
  O2sensor();
  ETsensor();
  TPsensor();

  Serial.print("TPS: ");  //DEBUGGING
  Serial.println(tps);
  Serial.print("O2 SET: ");
  Serial.println(O2set);
  Serial.print("O2 HEAT: ");
  Serial.println(O2heat);
  Serial.print("FUEL START ANGLE: ");
  Serial.println(fuelstan);
  Serial.print("REQUIRED FUEL: ");
  Serial.println(reqfuel);
  Serial.print("VE %: ");
  Serial.println(ve);
  Serial.print("INJECOR OPEN TIME: ");
  Serial.println(injopen);
  Serial.print("inj pw = ");
  Serial.println(pw);
}


void HOURmeter() {  //HOURMETER
  hourmeter = millis();
  minutes = hourmeter / 3600000;
}


void IRsensor() {  //RPM MEASUREMENT
  rpm = 0;
  currentstate = digitalRead(dataIN);
  if ( prevstate != currentstate)
  {
    if ( currentstate == HIGH )
    {
      duration = (millis() - prevmillis);
      rpm = (60000000 / duration);
      prevmillis = millis();
    }
  }
  prevstate = currentstate;
}


void O2sensor() {
  analogReference(INTERNAL);  //INTERNAL REFERENCE ACCURACY FOR O2 SENSOR
  O2 = analogRead(A0);  //READ O2 SENSOR
  O2voltage = O2 * (1.1 / 1023);
  O2new = map(O2voltage, 0.100, 1.100, 17.00, 13.00);  //MAP O2 VALUE
  analogReference(DEFAULT);  //RETURN ANALOG REFERENCE TO DEFAULT
  O2set = O2set / 10;
}


void   HMI_display_warning_oc() {
  if (minutes >= 50)  //OIL CHANGE WARNING MESSAGE
  {
    HMI_display_oc(oc);
  }
}


void  HMI_display_warning_gc() {

  if (minutes >= 500)  //GALLEY CHANGE WARNING MESSAGE
  {
    HMI_display_gc(gc);
  }
}


void ETsensor() {
  sensors.requestTemperatures();
  ets = sensors.getTempFByIndex(0);  //READ ETS
}


void TPsensor() {
  tpsprev = tps;
  etsenrich = intemp / ets;  //TEMP ENRICHMENT
  enrich = (O2 / O2set) * (etsenrich);  //GAMMA E
  accel = tps / tpsprev;  //ACCELERATION RATIO
  pw = reqfuel * ve * enrich * accel + injopen;  //INJ PW EQUATION
  if (millis() <= millis() + pw) {  //START COUNTING FOR INJ PW
    digitalWrite(injpin, HIGH);  //SET INJECTOR PIN HIGH FOR DURATION OF PW
  }
  digitalWrite(injpin, LOW);  //SET INJECTOR PIN BACK TO LOW
}


void HMI_display_rpm(int rpm) {  //RPM SCREEN FUNCTION
  mySerial.print(F("page1.n2.val=\""));
  mySerial.print(rpm);
  mySerial.print(F("\""));
  mySerial.write(0xff);
  mySerial.write(0xff);
  mySerial.write(0xff);
}


void HMI_display_ets(int ets) {  //ETS SCREEN FUNCTION
  mySerial.print(F("page1.n6.val=\""));
  mySerial.print(ets);
  mySerial.print(F("\""));
  mySerial.write(0xff);
  mySerial.write(0xff);
  mySerial.write(0xff);
}


void HMI_display_O2new(float O2new) {  //O2 SCREEN FUNCTION
  mySerial.print(F("page1.t1.txt=\""));
  mySerial.print(O2new);
  mySerial.print(F("\""));
  mySerial.write(0xff);
  mySerial.write(0xff);
  mySerial.write(0xff);
}


void HMI_display_minutes(float minutes) {  //HOURMETER SCREEN FUNCTION
  mySerial.print(F("page1.t2.txt=\""));
  mySerial.print(minutes);
  mySerial.print(F("\""));
  mySerial.write(0xff);
  mySerial.write(0xff);
  mySerial.write(0xff);
}


void HMI_display_oc(int oc) {  //OIL CHANGE DUE SCREEN FUNCTION
  mySerial.print(F("page1.t5.txt=\""));
  mySerial.print(F("OIL CHANGE DUE"));
  mySerial.print(oc);
  mySerial.print(F("\""));
  mySerial.write(0xff);
  mySerial.write(0xff);
  mySerial.write(0xff);
}


void HMI_display_gc(int gc) {  //OIL GALLEY CHANGE SCREEN FUNCTION
  mySerial.print(F("page1.t5.txt=\""));
  mySerial.print(F("GALLEY CHANGE DUE"));
  mySerial.print(gc);
  mySerial.print(F("\""));
  mySerial.write(0xff);
  mySerial.write(0xff);
  mySerial.write(0xff);
}

This is the code I'm playing with to get data sent to the Arduino from the nextion.

 if (numMessages == 1) {  //COMP ID MESSAGE
    numMessages = 0;
    if (pageNum == 1 && buttonNum == 23) {  //WAS THE PAGE NUMBER 1 AND BUTTON 23
      message = "";  //CLEAR THE MESSAGE
      pageNum = 255;
      buttonNum = 255;
      page1_button23();  //GO TO PAGE 1 CODE
    }
    if (pageNum == 2 && buttonNum == 2) {  //WAS THE PAGE NUMBER 2 AND BUTTON 2
      message = "";  //CLEAR THE MESSAGE
      pageNum = 255;
      buttonNum = 255;
      page2_button2();  //GO TO PAGE 2 CODE
    }
  }
  if (mySerial.available()) {  //IS DATA COMING IN FROM NEXTION
    inByte = mySerial.read();  //CAPTURE INBOUD DATA BIT
    if (inByte > -1 && inByte < 255) {  //COMP ID MESSAGE
      numBytes = numBytes + 1;  //KEEP TRACK OF DATA BITS
    }
    else if (inByte == 255) {  //IS IT AN END BIT
      endBytes = endBytes + 1;  //INCREMENT END BITS
    }
    if (numBytes == 2) {  //PAGE ID FROM "SEND COMP ID"
      pageNum = inByte;  //ASSIGN PAGE NUMBER
    }
    if (numBytes == 3) {  //BUTTON ID FROM "SEND COMP ID"
      buttonNum = inByte;  //ASSIGN BUTTON NUMBER
    }
    if (inByte == 255 && endBytes == 3) {  //ENTIRE MESSAGE?
      numMessages = numMessages + 1;
      endBytes = 0;
      numBytes = 0;
    }
  }


int getMessage() {  //CAPTURE DATA COMING FROM NEXTION
  int val;
  val = 0;
  while (endBytes < 3) {  //WAITING FOR COMPLETE MESSAGE **PROBLEM AREA?
    if (mySerial.available()) {
      inByte = mySerial.read();  //INCOMING DATA BITS
      if (inByte > 47 && inByte < 58) {  //BETWEEN 0 & 9?
        message.concat(char(inByte));  //MESSAGE BIT BY BIT
      }
      if (inByte == 255) {  //END BYTE?
        endBytes = endBytes + 1;
      }
      if (inByte == 255 && endBytes == 3) {  //MESSAGE COMPLETE?
        val = message.toInt();  //RETURN VARIABLE
        message = "";
        endBytes = 0;
        return val;  //RETURN VALUE
      }
    }
  }
  endBytes = 0;
}


void page1_button23() {  //PAGE 1 BUTTON 23 FUNCTION
  if (mySerial.read() == 255) {                                             
  }
  tps = getMessage();  //ASSIGN GETMESSAGE() TO VARIABLE
  //      newtps = map(tps, 0, 100, 0, 1600);  //TPS AND STEPPER
  //      stepper1.runToNewPosition(newtps);  //TPS AND STEPPER
}


void page2_button2() {  //PAGE 2 BUTTON 2 FUNCTION
  if (mySerial.read() == 255) {
  }
  O2set = getMessage();
  O2heat = getMessage();
  fuelstan = getMessage();
  reqfuel = getMessage();
  ve = getMessage();
  injopen = getMessage();
}