Exemple #1
0
//Toggle between zoom in and zoom out
void do_zoom(){
	Point sel = {0,0};
	if (zoom_level == ZOOM_IN){
		zoom_level = ZOOM_OUT;
	}
	else {
		zoom_level = ZOOM_IN;

		do{
			sel = GetPress();
		} while(sel.y > image_height[ZOOM_OUT] || sel.x > image_width[ZOOM_OUT]);

		sel = convert_pnt_to_zoom_in(sel);

		//we pass draw_image in the top left corner, sel should be the centre of the image
		sel.x -= DISPLAY_WIDTH/2;
		sel.y -= DISPLAY_HEIGHT/2;

		if(sel.x < 0)
			sel.x = 0;
		else if(sel.x > (image_width[ZOOM_IN] - DISPLAY_WIDTH))
			sel.x = image_width[ZOOM_IN]  - DISPLAY_WIDTH;

		if(sel.y < 0)
			sel.y = 0;
		else if(sel.y > (image_height[ZOOM_IN] - DISPLAY_HEIGHT))
			sel.y = image_height[ZOOM_IN] - DISPLAY_HEIGHT;
	}

	curr_image_pos = sel;
	draw_full_image();
	about_screen();
	ZOOM_BUTT.prs_p(ZOOM_BUTT);
	re_draw_path();
}
/*
 * Allows user to change the menu background colours as well as text colour and line (for connect-the-dots) colour.
 * Makes sure the text/background pair is acceptable (text is viewable on background).
 * Makes sure the line colour is not white and is not the same as the background colour.
 */
void SettingsMenu(Point* p, Colours* scheme){
	back_textPair pairs[NPAIRS]; //Initialise pairs of background/text colours
	pairs[INITPAIR].background = WHITE;
	pairs[INITPAIR].text = BLACK;
	pairs[1].background = CYAN;
	pairs[1].text = RED;
	pairs[2].background = YELLOW;
	pairs[2].text = BLUE;

	WriteFilledRectangle(0, 0, XRES-1, MENU_TOP-1, BLACK);//Clear background

	//Boolean
	int settingsTouched = 0;
	int buttonTouched = 0;// 0 == Menu just opened, 1 == Line, 2 == Text/Background
	do{
		//Redraw buttons/lines with new colours if the button pressed wasn't the settings button
		if(!settingsTouched){
			if(buttonTouched == 0 || buttonTouched == 2){
				WriteFilledRectangle(SET_LEFT_ALIGN, 0, SET_RIGHT, SET_TOP_YEND,scheme->menuBackground);//Create buttons
				WriteFilledRectangle(SET_LEFT_ALIGN, SET_BOT_YSTART, SET_RIGHT, SET_BOT_YEND,scheme->menuBackground);

				Text(SET_LEFT_ALIGN+10, (SET_TOP_YEND)/2, scheme->text, scheme->menuBackground, "Text/background", 0);//Print text on buttons
				Text(SET_LEFT_ALIGN+10, SET_BOT_YSTART + 1, scheme->text, scheme->menuBackground, "Line Colour", 0);
			}
			//Display example line
			WriteLine(SET_LEFT_ALIGN, SET_BOT_YEND-1, SET_RIGHT, SET_BOT_YSTART-1, scheme->connectTheDotsLine);
			WriteLine(SET_LEFT_ALIGN, SET_BOT_YEND, SET_RIGHT, SET_BOT_YSTART, scheme->connectTheDotsLine);
			WriteLine(SET_LEFT_ALIGN, SET_BOT_YEND+1, SET_RIGHT, SET_BOT_YSTART, scheme->connectTheDotsLine);
		}else{
			settingsTouched = 0;
		}

		*p = GetPress();

		//If the text/background colour button is pressed
		if(p->x <= SET_RIGHT && p->x >= SET_LEFT_ALIGN && p->y <= SET_TOP_YEND){
			buttonTouched = 2;
			do{
				scheme->menuBackground = pairs[(scheme->pairNum + 1) % NPAIRS].background;
				scheme->text = pairs[(scheme->pairNum + 1) % NPAIRS].text;
				scheme->pairNum = (scheme->pairNum + 1) % NPAIRS;
			}while(scheme->menuBackground == scheme->connectTheDotsLine);//Change the colour pair if the background was the same colour as the line
			GetRelease();
		}else if(p->x <= SET_RIGHT && p->x >= SET_LEFT_ALIGN && p->y <= SET_BOT_YEND && p->y > SET_BOT_YSTART){ //If the line colour button was pressed
			buttonTouched = 1;
			do{
				scheme->connectTheDotsLine = (scheme->connectTheDotsLine + 1) % NCOLOURS;
			}while(scheme->connectTheDotsLine == WHITE || scheme->connectTheDotsLine == scheme->menuBackground);//Change the line colour if it is white or is the same colour as the background
			GetRelease();
		}else if(!(p->x >= 2 * XRES / NMENUS && p->y >= MENU_TOP)){//If touched outside of this menu's buttons and not the settings button itself break out of menu
			break;
		}else{//Else the settings button was touched
			settingsTouched = 1;
		}
	}while(1); //Do this while in settings menu

}
int displayMenu(int *keyPressed, int *inputBoxPressed, int *buttonPressed,
		int * sdBoxPressed) {
	int validPress = 0;
	Point p;
	int choice = -1;
	int checkButtonPressed = -1;
	int checkKeyPressed = -1;
	int checkInputBoxPressed = -1;
	int checkSDBoxPressed = -1;

	// if we are outside the area, we will draw the panic page over home page
	if (panicFlag == 1) {
		if (globalCurrentPage == home) {
			globalCurrentPage = panic;
		}
	}
	drawPage(globalCurrentPage);
	while (validPress == 0) {
		//pen down
		GetPress(&p);
		checkButtonPressed = validpress(p, *globalCurrentPage, buttonPressed);
		checkKeyPressed = validkeypress(p, *globalCurrentPage, keyPressed);
		checkInputBoxPressed = validinputboxpress(p, *globalCurrentPage,
				inputBoxPressed);
		checkSDBoxPressed = validsdboxpress(p, *globalCurrentPage,
				sdBoxPressed);

		if (checkButtonPressed != -1 || checkKeyPressed != -1
				|| checkInputBoxPressed != -1 || checkSDBoxPressed != -1) {
			validPress = 1;
		}
		*keyPressed = -1;
		*inputBoxPressed = -1;
		*buttonPressed = -1;
		*sdBoxPressed = -1;
		if (validPress == 1) {
			validPress = 0;
			//pen up
			GetRelease(&p);

			choice = checkChoice(p, globalCurrentPage, keyPressed,
					inputBoxPressed, buttonPressed, sdBoxPressed);

			if (choice != -1 || *keyPressed != -1 || *buttonPressed != -1
					|| *inputBoxPressed != -1 || *sdBoxPressed != -1) {
				validPress = 1;
			}
		}
	}
	return choice;
}
/*
 * Displays the Save/Load menu.
 */
int SaveLoadMenu(Point* p, Colours* scheme, int prevAg){
	WriteFilledRectangle(0, 0, XRES-1, MENU_TOP-1, WHITE);

	//If the background is WHITE then just draw boarders in black for buttons
	if(scheme->menuBackground == WHITE){
		Rectangle(SL_LEFT_BOX_XSTART, SL_TOPBOX_YSTART, SL_LEFT_BOX_XEND, SL_TOPBOC_YEND, BLACK);
		Rectangle(SL_RIGHT_BOX_XSTART, SL_TOPBOX_YSTART, SL_RIGHT_BOX_XEND, SL_TOPBOC_YEND, BLACK);
		Rectangle(SL_UPPERBOX_XSTART, SL_UPPERBOX_YSTART, SL_UPPERBOX_XEND, SL_UPPERBOX_YEND, BLACK);
	}else{ //Else use scheme to determine button colour
		WriteFilledRectangle(SL_LEFT_BOX_XSTART, SL_TOPBOX_YSTART, SL_LEFT_BOX_XEND, SL_TOPBOC_YEND, scheme->menuBackground);
		WriteFilledRectangle(SL_RIGHT_BOX_XSTART, SL_TOPBOX_YSTART,  SL_RIGHT_BOX_XEND, SL_TOPBOC_YEND, scheme->menuBackground);
		WriteFilledRectangle(SL_UPPERBOX_XSTART, SL_UPPERBOX_YSTART, SL_UPPERBOX_XEND, SL_UPPERBOX_YEND, scheme->menuBackground);
	}

	//Draw text in buttons explaining them
	Text(SL_LEFT_BOX_XSTART+19, (SL_TOPBOX_YSTART + SL_TOPBOC_YEND)/2, scheme->text, scheme->menuBackground, "Load Latest Data", 0);
	Text(SL_RIGHT_BOX_XSTART+19, (SL_TOPBOX_YSTART + SL_TOPBOC_YEND)/2, scheme->text, scheme->menuBackground, "Load Aggregated Data", 0);
	Text(SL_UPPERBOX_XSTART+19, (SL_UPPERBOX_YSTART + SL_UPPERBOX_YEND)/2, scheme->text, scheme->menuBackground, "Download Path from BT", 0);

	do{
		*p = GetPress();

		if(p->y < SL_TOPBOC_YEND && p->y > SL_TOPBOX_YSTART && p->x > SL_LEFT_BOX_XSTART && p->x < SL_RIGHT_BOX_XEND){
			if(p->x < SL_LEFT_BOX_XEND){
				//Load latest data
				return FALSE;
			}else if(p->x > SL_RIGHT_BOX_XSTART){
				//Load aggregate
				return TRUE;
			}
		}else if(p->x > SL_UPPERBOX_XSTART && p->x < SL_UPPERBOX_XEND && p->y > SL_UPPERBOX_YSTART && p->y < SL_UPPERBOX_YEND){
			Text(10, 10, BLACK, WHITE, "Bluetooth communication in progress...", 1);
			processBT();
			setupAggregate();
			printf("Done setup Ag\n");
			if(!prevAg){
				gen_heatmap(localData.dataSets[localData.headTimeQueue].points, localData.dataSets[localData.headTimeQueue].size, *scheme);
				printf("Done gen heatmap\n");
			}
			return FALSE;
		}
	}while(p->x < XRES/3 && p->y > MENU_TOP);


	return prevAg;
}
Exemple #5
0
double MOCPumpConfig::GetPower(double dX)
{
	double dNewPower = 0;
	double dPress = GetPress(dX);
	double dMass = dX;
	if(0 == FlowType())//体积流量
		dX = MOCFluid::TranMassToQ(dX);
	if(dX > MaxFlow())
		dX =  MaxFlow();
	if(dX < 0)
		dX = 0;
	dNewPower = m_CurvePower.GetY(m_PowerData,dX);
	if(fabs(dNewPower)<1E-6||dNewPower<0)
		return 0;
	if(0==PowerType())
	{
		double dPe = CalcPe(dMass,dPress);
		dNewPower = dPe*100/dNewPower;
	}
	return dNewPower;
}
/*
 * Displays the interpret menu
 */
void InterpretMenu(Point* p, Colours* scheme){
	WriteFilledRectangle(0, 0, XRES-1, MENU_TOP-1, scheme->menuBackground);

	char* str = "Time South:    %";
	str[12] = (char)((int)percentageS + '0');
	str[13] = (char)((int)(10 * percentageS) % 10 + '0');
	str[14] = (char)((int)(100 * percentageS) % 10 + '0');

	if(str[12] == '0'){
		str[12] = ' ';
		if(str[13] == '0'){
			str[13] = ' ';
		}
	}

	Text(I_LEFT_ALIGN, I_TOP_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	str = "Time North:    %";

	str[12] = (char)((int)percentageN + '0');
	str[13] = (char)((int)(10 * percentageN) % 10 + '0');
	str[14] = (char)((int)(100 * percentageN) % 10 + '0');

	if(str[12] == '0'){
		str[12] = ' ';
		if(str[13] == '0'){
			str[13] = ' ';
		}
	}

	Text(I_LEFT_ALIGN, I_BOT_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	str = "Time East:    %";

	str[11] = (char)((int)percentageE + '0');
	str[12] = (char)((int)(10 * percentageE) % 10 + '0');
	str[13] = (char)((int)(100 * percentageE) % 10 + '0');

	if(str[11] == '0'){
		str[11] = ' ';
		if(str[12] == '0'){
			str[12] = ' ';
		}
	}

	Text(I_RIGHT_ALIGN, I_TOP_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	str = "Time West:    %";

	str[11] = (char)((int)percentageW + '0');
	str[12] = (char)((int)(10 * percentageW) % 10 + '0');
	str[13] = (char)((int)(100 * percentageW) % 10 + '0');

	if(str[11] == '0'){
		str[11] = ' ';
		if(str[12] == '0'){
			str[12] = ' ';
		}
	}

	Text(I_RIGHT_ALIGN, I_BOT_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	if(localData.dataSets[localData.headTimeQueue].size == currNPoints){
		int timeTaken = currNPoints * TIME_PER_POINT / 60;
		if(timeTaken > 999){
			str = "Time Taken: >999 minutes";
		}else{
			str = "Time Taken:     minute(s)";//In minutes, max 999
			str[12] = (char)(timeTaken/100 + '0');
			str[13] = (char)((timeTaken/10) % 10 + '0');
			str[14] = (char)(timeTaken % 10 + '0');

			if(str[12] == '0'){
				str[12] = ' ';
				if(str[13] == '0'){
					str[13] = ' ';
				}
			}
		}

		Text(XRES/2 - 125, I_BOT_ALIGN + BUFFER_BTW_BUTTONS, scheme->text, scheme->menuBackground, str, 0);
	}else{
		int nSets = 0;
		int i;
		for(i = 0; i < MAX_N_SETS; i++){
			if(localData.dataSets[i].size > 0){
				nSets++;
			}
		}

		int averageTimeTaken = currNPoints * TIME_PER_POINT / 60 / nSets;
		if(averageTimeTaken > 999){
			str = "Average Time Taken: >999 minutes";
		}else{
			str = "Average Time Taken:     minute(s)";//In minutes, max 999
			str[20] = (char)(averageTimeTaken/100 + '0');
			str[21] = (char)((averageTimeTaken/10) % 10 + '0');
			str[22] = (char)(averageTimeTaken % 10 + '0');

			if(str[20] == '0'){
				str[20] = ' ';
				if(str[21] == '0'){
					str[21] = ' ';
				}
			}
		}
		Text(XRES/2 - 200, I_BOT_ALIGN + BUFFER_BTW_BUTTONS, scheme->text, scheme->menuBackground, str, 0);
	}


	do{
		*p = GetPress();
	}while(p->x > XRES/NMENUS && p->x < 2*XRES/NMENUS && p->y > MENU_TOP);
}
//センサからデータを取得
void* SensorDataThread(void *param)
{
	sigset_t	ss;
	siginfo_t	sig;
	struct timespec timeOut;
	int sigNo;
	int oldOutputMode = MODE_CLOCK;
	unsigned int i;
	const unsigned int dpSleepTime = 100000;

	//log用
	time_t 		t;
	struct tm 	*ts;
	char		dateBuf[20];

	//シグナルのタイムアウト
	timeOut.tv_sec = g_dataInterval;
	timeOut.tv_nsec = 0;
	if( SetSignalBlock(&ss) == -1 )
		pthread_exit(NULL);

	//スレッドを高優先に
	SetPriority(HIGH_PRIO);

	do{
		if( sigNo == THREAD_MSG_EXIT )
		{
			MySysLog(LOG_DEBUG, "Data Thread exit signal\n");
			break;
		}
		//センサー間隔が1分以上はセンサー実行時アニメーションモードにする
		if( g_dataInterval >= 60 )
		{
			oldOutputMode	= g_outputMode;
			g_outputMode	= MODE_ANI_0;
		}

		//DPの桁

		//sensorが何かで止まるので個別にログを取ってどこで止まるか確認
		//log用の時間
		t  = time(NULL);
		ts = localtime(&t);
		//strftime(dateBuf, sizeof(dateBuf), "%F %T", ts);
		strftime(dateBuf, sizeof(dateBuf), "%T", ts);
		SensorLogPrintf(SENSOR_LOG_LEVEL_0, 	"%s\t",		dateBuf);		//時刻

		i = 0;
		//Lps331をone shotモードでたたき起こす
			//SetDP(i++, DP_ON);
			usleep(dpSleepTime);
			WakeUpLps331();

		//外気温
			//SetDP(i++, DP_ON);
			usleep(dpSleepTime);
			g_temp	= GetTemp();
			SensorLogPrintf(SENSOR_LOG_LEVEL_0, 	"%.1f\t", 	g_temp);		//外気温

		//気圧
			//SetDP(i++, DP_ON);
			usleep(dpSleepTime);
			g_press	= GetPress();

			SensorLogPrintf(SENSOR_LOG_LEVEL_0, 	"%.1f\t",	g_press);		//大気圧

		//照度
			//SetDP(i++, DP_ON);
			usleep(dpSleepTime);
			//g_lux   = GetLuxOhm(100e+3); //100kohm
			g_lux	= GetLux();
			Set7segLightControl(g_lux);
			if( g_lux < 1 )
				SensorLogPrintf(SENSOR_LOG_LEVEL_0, "%.4f\t", 	g_lux);			//照度
			else
				SensorLogPrintf(SENSOR_LOG_LEVEL_0, "%.1f\t", 	g_lux);			//照度

		//湿度
			g_hum	= GetHumidity();
			SensorLogPrintf(SENSOR_LOG_LEVEL_0, 	"%.1f\t",	g_hum);			//湿度


		//CPU温度
			g_coreTemp = GetCoreTemp();
			SensorLogPrintf(SENSOR_LOG_LEVEL_0, 	"%.1f\n",	g_coreTemp);	//CPU温度


		usleep(dpSleepTime);
		//for( i=0; i<SEG_COUNT; i++)
		//	SetDP(i, DP_OFF);
			//g_dispData[i] &= ~(SEG_DP);


		////正常にデータ取得後データの保存
		//SensorLog();


		//モードを元に戻す
		if( g_dataInterval >= 60 )
			g_outputMode = oldOutputMode;

		//残り時間用に現在の時間の取得
		clock_gettime(CLOCK_MONOTONIC, &g_waitLog);

		sigNo = sigtimedwait( &ss, &sig, &timeOut);
		//何らかの形でシグナルが来なかった時の保険
		if( g_threadStatus == 0 )
			break;
	}while( 1 );

	SetPriority(NOMAL_PRIO);

	g_threadStatus = 0;

	pthread_exit(NULL);
}
/*
 * Displays the Save/Load menu.
 */
void SaveLoadMenu(Point* p, Colours* scheme){
	WriteFilledRectangle(0, 0, XRES-1, MENU_TOP-1, WHITE);

	//If the background is WHITE then just draw boarders in black for buttons
	if(scheme->menuBackground == WHITE){
		Rectangle(SL_LEFT_BOX_XSTART, SL_TOPBOX_YSTART, SL_LEFT_BOX_XEND, SL_TOPBOC_YEND, BLACK);
		Rectangle(SL_RIGHT_BOX_XSTART, SL_TOPBOX_YSTART, SL_RIGHT_BOX_XEND, SL_TOPBOC_YEND, BLACK);
		Rectangle(SL_LEFT_BOX_XSTART, SL_LOWBOX_YSTART, SL_LEFT_BOX_XEND, SL_LOWBOX_YEND, BLACK);
		Rectangle(SL_RIGHT_BOX_XSTART, SL_LOWBOX_YSTART, SL_RIGHT_BOX_XEND, SL_LOWBOX_YEND, BLACK);
	}else{ //Else use scheme to determine button colour
		WriteFilledRectangle(SL_LEFT_BOX_XSTART, SL_TOPBOX_YSTART, SL_LEFT_BOX_XEND, SL_TOPBOC_YEND, scheme->menuBackground);
		WriteFilledRectangle(SL_RIGHT_BOX_XSTART, SL_TOPBOX_YSTART,  SL_RIGHT_BOX_XEND, SL_TOPBOC_YEND, scheme->menuBackground);
		WriteFilledRectangle(SL_LEFT_BOX_XSTART, SL_LOWBOX_YSTART, SL_LEFT_BOX_XEND, SL_LOWBOX_YEND, scheme->menuBackground);
		WriteFilledRectangle(SL_RIGHT_BOX_XSTART, SL_LOWBOX_YSTART, SL_RIGHT_BOX_XEND, SL_LOWBOX_YEND, scheme->menuBackground);
	}

	//Draw text in buttons explaining them
	Text((SL_LEFT_BOX_XSTART + SL_LEFT_BOX_XEND)/2-19, (SL_TOPBOX_YSTART + SL_TOPBOC_YEND)/2-5, scheme->text, scheme->menuBackground, "<", 0);
	Text((SL_RIGHT_BOX_XSTART + SL_RIGHT_BOX_XEND)/2+19, (SL_TOPBOX_YSTART + SL_TOPBOC_YEND)/2-5, scheme->text, scheme->menuBackground, ">", 0);
	Text(SL_LEFT_BOX_XSTART + 10, SL_LOWBOX_YSTART + 10, scheme->text, scheme->menuBackground, "Load", 0);
	Text(SL_RIGHT_BOX_XSTART + 10, SL_LOWBOX_YSTART + 10, scheme->text, scheme->menuBackground, "Save", 0);

	int set = 0;//0 == GPS, else dataSet = set - 1.
	char* str = "DataSet   ";
	Text(XRES/2-25, (YRES/2 + 50)/2, scheme->text, scheme->menuBackground, "GPS", 0);

	//boolean
	int buttonTouched = 0;
	do{
		if(buttonTouched){
			buttonTouched = 0;
		}

		*p = GetPress();

		if(p->y > SL_TOPBOX_YSTART && p->y < SL_TOPBOC_YEND){
			//if decrement button touched, decrement set, display such has been done to user
			if(p->x > SL_LEFT_BOX_XSTART && p->x < SL_LEFT_BOX_XEND){
				buttonTouched = 1;
				WriteFilledRectangle(SL_LEFT_BOX_XEND + 1, SL_TOPBOX_YSTART, SL_RIGHT_BOX_XSTART - 1, SL_TOPBOC_YEND, WHITE);

				if(set == 0){
					set = MAX_N_SETS;//wrap-around
				}else{
					set--;
				}

				if(set == 0){
					Text(XRES/2-25, (YRES/2 + 50)/2, scheme->text, scheme->menuBackground, "GPS", 0);
				}else{
					str[8] = (char)(set / 10) + '0';
					str[9] = (char)(set % 10) + '0';
					if(str[8] == '0'){
						str[8] = str[9];
						str[9] = '\0';
					}

					Text(XRES/2-45, (YRES/2 + 50)/2, scheme->text, scheme->menuBackground, str, 0);
				}

				GetRelease();
			}else if(p->x > SL_RIGHT_BOX_XSTART && p->x < SL_RIGHT_BOX_XEND){
				//if increment button touched, increment set, display such has been done to user
				buttonTouched = 1;
				WriteFilledRectangle(SL_LEFT_BOX_XEND + 1, SL_TOPBOX_YSTART, SL_RIGHT_BOX_XSTART - 1, SL_TOPBOC_YEND, WHITE);

				if(set == MAX_N_SETS){
					set = 0;//wrap-around
				}else{
					set++;
				}

				if(set == 0){
					Text(XRES/2-25, (YRES/2 + 50)/2, scheme->text, scheme->menuBackground, "GPS", 0);
				}else{
					str[8] = (char)(set / 10) + '0';
					str[9] = (char)(set % 10) + '0';
					if(str[8] == '0'){
						str[8] = str[9];
						str[9] = '\0';
					}

					Text(XRES/2-45, (YRES/2 + 50)/2, scheme->text, scheme->menuBackground, str, 0);
				}

				GetRelease();
			}
		}else if(p->y < SL_LOWBOX_YEND && p->y > SL_LOWBOX_YSTART){
			//If load button touched, do following
			if(p->x > SL_LEFT_BOX_XSTART && p->x < SL_LEFT_BOX_XEND){
				buttonTouched = 1;

				if (set != 0) {
					//GPS is set 0 so we add 1 to get the correct index
					load_into_workingDataSet(set-1);
				} else {
					loadgps_workingDataSet();
				}

				return;
			}else if(p->x > SL_RIGHT_BOX_XSTART && p->x < SL_RIGHT_BOX_XEND){
				//If save button touched, do following
				buttonTouched = 1;
		
				if (set != 0) { // check set number since cannot save to GPS
					//GPS is set 0 so we add 1 to get the correct index
					save_from_workingDataSet(set-1);
				}

				WriteFilledRectangle(SL_LEFT_BOX_XSTART, 0, XRES-1, SL_TOPBOX_YSTART-1, WHITE);
				if(set == 0){
					Text(XRES/3-45, 10, BLACK, WHITE, "Cannot save to GPS", 0);
					}else{
					char tmpStr[strlen(str)+26];
					strcpy(tmpStr, "Current DataSet saved to ");
					strcpy(tmpStr+25,str);

					Text(XRES/3-45, 10, BLACK, WHITE, tmpStr, 0);
				}

				GetRelease();
			}
		}

	}while(buttonTouched || (p->y > MENU_TOP && p->x < XRES/NMENUS)); //Do this while a button in the submenu has been touched or the Save/Load menu button has been touched
}
/*
 * Displays the interpret menu
 */
void InterpretMenu(Point* p, Colours* scheme){
	WriteFilledRectangle(0, 0, XRES-1, MENU_TOP-1, scheme->menuBackground);

	char* str = "Time on Right:    %";
	str[15] = (char)((int)percentageRight + '0');
	str[16] = (char)((int)(10 * percentageRight) % 10 + '0');
	str[17] = (char)((int)(100 * percentageRight) % 10 + '0');

	if(str[15] == '0'){
		str[15] = ' ';
		if(str[16] == '0'){
			str[16] = ' ';
		}
	}

	Text(I_LEFT_ALIGN, I_TOP_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	str = "Time on Left:    %";

	str[14] = (char)((int)percentageLeft + '0');
	str[15] = (char)((int)(10 * percentageLeft) % 10 + '0');
	str[16] = (char)((int)(100 * percentageLeft) % 10 + '0');

	if(str[14] == '0'){
		str[14] = ' ';
		if(str[15] == '0'){
			str[15] = ' ';
		}
	}

	Text(I_LEFT_ALIGN, I_BOT_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	str = "Time Forward:    %";

	str[14] = (char)((int)percentageForward + '0');
	str[15] = (char)((int)(10 * percentageForward) % 10 + '0');
	str[16] = (char)((int)(100 * percentageForward) % 10 + '0');

	if(str[14] == '0'){
		str[14] = ' ';
		if(str[15] == '0'){
			str[15] = ' ';
		}
	}

	Text(I_RIGHT_ALIGN, I_TOP_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	str = "Time Back:    %";

	str[11] = (char)((int)percentageBack + '0');
	str[12] = (char)((int)(10 * percentageBack) % 10 + '0');
	str[13] = (char)((int)(100 * percentageBack) % 10 + '0');

	if(str[11] == '0'){
		str[11] = ' ';
		if(str[12] == '0'){
			str[12] = ' ';
		}
	}

	Text(I_RIGHT_ALIGN, I_BOT_ALIGN, scheme->text, scheme->menuBackground, str, 0);

	do{
		*p = GetPress();
	}while(p->x > XRES/NMENUS && p->x < 2*XRES/NMENUS && p->y > MENU_TOP);
}