Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Ghost/Ghost.cpp
- Revision:
- 25:31761087a83f
- Parent:
- 17:4c5f25d5c4d5
--- a/Ghost/Ghost.cpp Sat Mar 28 15:09:46 2020 +0000
+++ b/Ghost/Ghost.cpp Wed Apr 29 10:53:21 2020 +0000
@@ -43,7 +43,7 @@
// SD INITIALISATION / FORMATTING
//----------------------------------
-void Ghost::SD_init(SDFileSystem &SD) //Sets up the SD card so that it contains the right files and writes them with data
+void Ghost::SD_init(SDFileSystem &SD, N5110 &LCD) //Sets up the SD card so that it contains the right files and writes them with data
{
for(int i = 0; i < 6000; i++) { //Up to 6000 frames (max)
Ghost_Data[i].x = 10000; //Set the Ghost_Data position to be way out of map bounds
@@ -51,21 +51,45 @@
}
//Write each different file for each combination of car and track with Ghost_Data
+ LCD.clear();
+ LCD.printString("FORMATTING",0,0);
+ LCD.printString("| |",0,1);
+ LCD.refresh();
SD_Write(Small, Basic, 6000, SD);
SD_Write(Small, Offroad, 6000, SD);
SD_Write(Small, Drifter, 6000, SD);
+ LCD.clear();
+ LCD.printString("FORMATTING",0,0);
+ LCD.printString("|** |",0,1);
+ LCD.refresh();
SD_Write(Small, Sportscar, 6000, SD);
SD_Write(Small, Racecar, 6000, SD);
SD_Write(Small, Stupid, 6000, SD);
+ LCD.clear();
+ LCD.printString("FORMATTING",0,0);
+ LCD.printString("|**** |",0,1);
+ LCD.refresh();
SD_Write(Medium, Basic, 6000, SD);
SD_Write(Medium, Offroad, 6000, SD);
SD_Write(Medium, Drifter, 6000, SD);
+ LCD.clear();
+ LCD.printString("FORMATTING",0,0);
+ LCD.printString("|****** |",0,1);
+ LCD.refresh();
SD_Write(Medium, Sportscar, 6000, SD);
SD_Write(Medium, Racecar, 6000, SD);
SD_Write(Medium, Stupid, 6000, SD);
+ LCD.clear();
+ LCD.printString("FORMATTING",0,0);
+ LCD.printString("|******** |",0,1);
+ LCD.refresh();
SD_Write(Large, Basic, 6000, SD);
SD_Write(Large, Offroad, 6000, SD);
SD_Write(Large, Drifter, 6000, SD);
+ LCD.clear();
+ LCD.printString("FORMATTING",0,0);
+ LCD.printString("|********** |",0,1);
+ LCD.refresh();
SD_Write(Large, Sportscar, 6000, SD);
SD_Write(Large, Racecar, 6000, SD);
SD_Write(Large, Stupid, 6000, SD);
@@ -164,6 +188,9 @@
} else { //Else
for(int i = 0; i < race_time; i++) { //Write Ghost_Data to SD up to the race_time for the ghost_Data
fprintf(file_data, "%f,%f\n",Ghost_Data[i].x,Ghost_Data[i].y);
+ #ifdef DEBUG_GHOST_WRITE
+ printf("%f,%f\n", Ghost_Data[i].x, Ghost_Data[i].y);
+ #endif
}
for(int i = 0; i < (6000 - race_time); i++) { //For the remaining time
float end_point = 10000;
@@ -267,6 +294,9 @@
fscanf(file_data, "%f,%f", &x_point, &y_point); //Read the point data for each frame
Ghost_Held_Data[i].x = x_point; //Save each point to Ghost_Held_Data
Ghost_Held_Data[i].y = y_point;
+ #ifdef DEBUG_GHOST_READ
+ printf("%f,%f\n", x_point, y_point);
+ #endif
}
for(int i = 0; i < (6000 - race_time); i++) { //For the remaining time
Ghost_Held_Data[(i + race_time)].x = 10000; //Set Ghost_Held_Data to 10000,10000