Tutorial - How to change firmware on 8u2

I tried to implement the state machine you suggested Stimmer.
However, I get the "adress out of range" error in Flip.
I assume this is because I ran out of program space.
My main loop now looks like this.

int main(void)
{
      SetupHardware();
      
      LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
      sei();
      
      for (;;)
      {
            HID_Device_USBTask(&Joystick_HID_Interface);
            USB_USBTask();
            
            if (Serial_IsCharReceived())
                  {
                  sensorIdentification =Serial_RxByte();
                  dataReceived = true;
                  }
            
            if (Serial_IsCharReceived() && dataReceived)
                  {
                  if             (sensorIdentification == "a") {sensorA =  Serial_RxByte();}
                  else if (sensorIdentification == "b") {sensorB =  Serial_RxByte();}
                  else if (sensorIdentification == "c") {sensorC =  Serial_RxByte();}
                  else if (sensorIdentification == "d") {sensorD =  Serial_RxByte();}
                  else    {Serial_RxByte();}
                  
                  dataReceived = false;
                  }

      }
}

The "create hid report" like this:

bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
                                         uint8_t* const ReportID,
                                         const uint8_t ReportType,
                                         void* ReportData,
                                         uint16_t* const ReportSize)
{
USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;

JoystickReport->X  =  sensorA;
JoystickReport->Y  =  sensorB;
JoystickReport->Z  =  sensorC;
JoystickReport->Rz =  sensorD;


*ReportSize = sizeof(USB_JoystickReport_Data_t);
      return false; 
}

As it stands right now, nonfunctional.
Even when I try to only transmit the data for sensor A with the X-axis, so I'm doing a few things wrong I think.