Fixed LowLevel Keyboard demo not saving the issued report only after it has been...
[pub/USBasp.git] / Demos / Device / LowLevel / Mouse / Mouse.c
index 4b318e3..ff54c65 100644 (file)
@@ -268,9 +268,6 @@ void SendNextReport(void)
        if ((MouseReportData.Y != 0) || (MouseReportData.X != 0))\r
          SendReport = true;\r
        \r
-       /* Save the current report data for later comparison to check for changes */\r
-       PrevMouseReportData = MouseReportData;\r
-       \r
        /* Check if the idle period is set and has elapsed */\r
        if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))\r
        {\r
@@ -286,7 +283,10 @@ void SendNextReport(void)
 \r
        /* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */\r
        if (Endpoint_IsReadWriteAllowed() && SendReport)\r
-       {\r
+       {       \r
+               /* Save the current report data for later comparison to check for changes */\r
+               PrevMouseReportData = MouseReportData;\r
+\r
                /* Write Mouse Report Data */\r
                Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));\r
                \r