Example #1
0
void nightMode(uint8_t on){
  if(initNightMode(on)){
    changeScreen(screenNumber);
  }
}
Example #2
0
// Initializes all the screen and screenitem variables in all
// the screens that might be displayed
void initAllScreens(void){
	// Initialize colors
	backgroundColor = RA8875_WHITE;
	foregroundColor = RA8875_BLACK;
	initNightMode(switches[3].value);

	// All Screens Stuff
	allScreens[GENERAL_SCREEN] = &generalScreen;
	generalScreen.items = generalItems;
	generalScreen.len = 6;
	initScreenItem(&generalItems[0], 20, 30, 15, redrawRotary, &rotary[0]);
	initScreenItem(&generalItems[1], 20, 30, 15, redrawRotary, &rotary[1]);
	initScreenItem(&generalItems[2], 20, 30, 15, redrawRotary, &rotary[2]);
	initScreenItem(&generalItems[3], 20, 30, 15, redrawFanSw, &switches[0]);
	initScreenItem(&generalItems[4], 20, 30, 15, redrawFUELPumpSw, &switches[1]);
	initScreenItem(&generalItems[5], 20, 30, 15, redrawWTRPumpSw, &switches[2]);

	// Race Screen Stuff
	allScreens[RACE_SCREEN] = &raceScreen;
	raceScreen.items = raceScreenItems;
	raceScreen.len = 8;
	initScreenItem(&raceScreenItems[0], 120, 20, 15, redrawFanSw, *fanSw);
	initScreenItem(&raceScreenItems[1], 240, 20, 15, redrawFUELPumpSw,*fuelSw);
	initScreenItem(&raceScreenItems[2], 360, 20, 15, redrawWTRPumpSw, *wtrSw);
	initScreenItem(&raceScreenItems[3], 20, 70, 30, redrawDigit, &oilTemp);
	initScreenItem(&raceScreenItems[4], 330, 70, 30, redrawDigit, &waterTemp);
	initScreenItem(&raceScreenItems[5], 20, 190, 30, redrawDigit, &oilPress);
	initScreenItem(&raceScreenItems[6], 330, 180, 30, redrawDigit, &batVoltage);
	initScreenItem(&raceScreenItems[7], 170, 50, 100, redrawGearPos, &gearPos);

	// PDM stuff
	allScreens[PDM_DRAW_SCREEN] = &pdmDrawScreen;
	pdmDrawScreen.items = pdmDrawItems;
	pdmDrawScreen.len = 20;
	initScreenItem(&pdmDrawItems[1], 10, 50, 15, redrawDigit, &pdmIGNdraw);
	initScreenItem(&pdmDrawItems[2], 85, 50, 15, redrawDigit, &pdmINJdraw);
	initScreenItem(&pdmDrawItems[3], 160, 50, 15, redrawDigit, &pdmFUELdraw);
	initScreenItem(&pdmDrawItems[4], 235, 50, 15, redrawDigit, &pdmECUdraw);
	initScreenItem(&pdmDrawItems[5], 310, 50, 15, redrawDigit, &pdmWTRdraw);
	initScreenItem(&pdmDrawItems[6], 385, 50, 15, redrawDigit, &pdmFANdraw);
	initScreenItem(&pdmDrawItems[7], 10, 100, 15, redrawDigit, &pdmAUXdraw);
	initScreenItem(&pdmDrawItems[8], 85, 100, 15, redrawDigit, &pdmPDLUdraw);
	initScreenItem(&pdmDrawItems[9], 160, 100, 15, redrawDigit, &pdmPDLDdraw);
	initScreenItem(&pdmDrawItems[10], 235, 100, 15, redrawDigit, &pdm5v5draw);
	initScreenItem(&pdmDrawItems[11], 310, 100, 15, redrawDigit, &pdmBATdraw);
	initScreenItem(&pdmDrawItems[16], 385, 100, 15, redrawDigit, &pdmFUELPcut);
	initScreenItem(&pdmDrawItems[17], 10, 150, 15, redrawDigit, &pdmECUPcut);
	initScreenItem(&pdmDrawItems[18], 85, 150, 15, redrawDigit, &pdmWTRPcut);
	initScreenItem(&pdmDrawItems[19], 160, 150, 15, redrawDigit, &pdmFANPcut);
	initScreenItem(&pdmDrawItems[12], 10, 200, 15, redrawDigit, &pdmSTR0draw);
	initScreenItem(&pdmDrawItems[13], 100, 200, 15, redrawDigit, &pdmSTR1draw);
	initScreenItem(&pdmDrawItems[14], 190, 200, 15, redrawDigit, &pdmSTR2draw);
	initScreenItem(&pdmDrawItems[15], 280, 200, 15, redrawDigit, &pdmSTRdraw);
	initScreenItem(&pdmDrawItems[0], 370, 200, 15, redrawDigit, &pdmCurrentDraw);


	allScreens[PDM_CUT_SCREEN] = &pdmCutScreen;
	pdmCutScreen.items = pdmCutItems;
	pdmCutScreen.len = 21;
	initScreenItem(&pdmCutItems[0], 10, 50, 15, redrawDigit, &pdmTemp);
	initScreenItem(&pdmCutItems[1], 85, 50, 15, redrawDigit, &pdmICTemp);
	initScreenItem(&pdmCutItems[4], 310, 50, 15, redrawDigit, &pdm5v5);
	initScreenItem(&pdmCutItems[5], 385, 50, 15, redrawDigit, &pdm5v);
	initScreenItem(&pdmCutItems[6], 10, 100, 15, redrawDigit, &pdm3v3);
	initScreenItem(&pdmCutItems[7], 85, 100, 15, redrawDigit, &pdmIGNcut);
	initScreenItem(&pdmCutItems[8], 160, 100, 15, redrawDigit, &pdmINJcut);
	initScreenItem(&pdmCutItems[9], 235, 100, 15, redrawDigit, &pdmFUELNcut);
	pdmECUNcut.decDigits = 1;
	pdmECUNcut.wholeDigits = 2;
	initScreenItem(&pdmCutItems[10], 160, 50, 15, redrawDigit, &pdmECUNcut);
	//initScreenItem(&pdmCutItems[11], 385, 100, 15, redrawDigit, &pdmWTRNcut);
	initScreenItem(&pdmCutItems[12], 10, 150, 15, redrawDigit, &pdmFANNcut);
	initScreenItem(&pdmCutItems[13], 85, 150, 15, redrawDigit, &pdmAUXcut);
	initScreenItem(&pdmCutItems[14], 160, 150, 15, redrawDigit, &pdmPDLUcut);
	initScreenItem(&pdmCutItems[15], 235, 150, 15, redrawDigit, &pdmPDLDcut);
	initScreenItem(&pdmCutItems[16], 310, 150, 15, redrawDigit, &pdm5v5cut);
	initScreenItem(&pdmCutItems[17], 385, 150, 15, redrawDigit, &pdmBATcut);
	initScreenItem(&pdmCutItems[18], 10, 200, 15, redrawDigit, &pdmSTR0cut);
	//initScreenItem(&pdmCutItems[19], 85, 200, 15, redrawDigit, &pdmSTR1cut);
	//initScreenItem(&pdmCutItems[20], 160, 200, 15, redrawDigit, &pdmSTR2cut);
    
    //brake pressure 
    initScreenItem(&pdmCutItems[19], 85, 200, 15, redrawDigit,&brakePressFront);
    initScreenItem(&pdmCutItems[20], 160, 200, 15, redrawDigit, &brakePressRear);
    
	initScreenItem(&pdmCutItems[2], 235, 200, 15, redrawDigit, &pdmVBat);
	initScreenItem(&pdmCutItems[3], 330, 200, 15, redrawDigit, &pdm12v);


	// MoTec Stuff
	allScreens[MOTEC_SCREEN] = &motecScreen;
	motecScreen.items = motecItems;
	motecScreen.len = 30;
	initScreenItem(&motecItems[0], 10, 30, 20, redrawDigit, &rpm);
	initScreenItem(&motecItems[1], 10, 30, 20, redrawDigit, &throtPos);
	initScreenItem(&motecItems[2], 10, 30, 20, redrawDigit, &oilPress);
	initScreenItem(&motecItems[3], 10, 30, 20, redrawDigit, &oilTemp);
	initScreenItem(&motecItems[4], 10, 30, 20, redrawDigit, &waterTemp);
	initScreenItem(&motecItems[5], 10, 30, 20, redrawDigit, &lambda);
	initScreenItem(&motecItems[6], 10, 30, 20, redrawDigit, &manifoldPress);
	initScreenItem(&motecItems[7], 10, 30, 20, redrawDigit, &batVoltage);
	initScreenItem(&motecItems[8], 10, 30, 20, redrawDigit, &wheelSpeedFL);
	initScreenItem(&motecItems[9], 10, 30, 20, redrawDigit, &wheelSpeedFR);
	initScreenItem(&motecItems[10], 10, 30, 20, redrawDigit, &wheelSpeedRL);
	initScreenItem(&motecItems[11], 10, 30, 20, redrawDigit, &wheelSpeedRR);
	initScreenItem(&motecItems[12], 10, 30, 20, redrawDigit, &gpsLat);
	initScreenItem(&motecItems[13], 10, 30, 20, redrawDigit, &gpsLong);
	initScreenItem(&motecItems[14], 10, 30, 20, redrawDigit, &groundSpeed);
	initScreenItem(&motecItems[15], 10, 30, 20, redrawDigit, &driveSpeed);
	initScreenItem(&motecItems[16], 10, 30, 20, redrawDigit, &gpsSpeed);
	initScreenItem(&motecItems[17], 10, 30, 20, redrawDigit, &manifoldTemp);
	initScreenItem(&motecItems[18], 10, 30, 20, redrawDigit, &ambientTemp);
	initScreenItem(&motecItems[19], 10, 30, 20, redrawDigit, &ambientPress);
	initScreenItem(&motecItems[20], 10, 30, 20, redrawDigit, &fuelTemp);
	initScreenItem(&motecItems[21], 10, 30, 20, redrawDigit, &fuelPress);
	initScreenItem(&motecItems[22], 10, 30, 20, redrawDigit, &lambda1);
	initScreenItem(&motecItems[23], 10, 30, 20, redrawDigit, &lambda2);
	initScreenItem(&motecItems[24], 10, 30, 20, redrawDigit, &lambda3);
	initScreenItem(&motecItems[25], 10, 30, 20, redrawDigit, &lambda4);
	initScreenItem(&motecItems[26], 10, 30, 20, redrawDigit, &lcEnablity);
	initScreenItem(&motecItems[27], 10, 30, 20, redrawDigit, &fuelConsum);
	initScreenItem(&motecItems[28], 10, 30, 20, redrawDigit, &gpsAltitude);
	initScreenItem(&motecItems[29], 10, 30, 20, redrawDigit, &gpsTime);
	initScreenItem(&motecItems[30], 10, 30, 20, redrawDigit, &fuelInjDuty);
	initScreenItem(&motecItems[31], 10, 30, 20, redrawDigit, &fuelTrim);

	// End Race Screen
	allScreens[END_RACE_SCREEN] = &endRaceScreen;
	endRaceScreen.items = endRaceItems;
	endRaceScreen.len = 9;
	initScreenItem(&endRaceItems[0], 10, 30, 20, redrawDigit, &endLogNum);
	initScreenItem(&endRaceItems[1], 10, 30, 20, redrawDigit, &endNumLaps);
	initScreenItem(&endRaceItems[2], 10, 30, 20, redrawDigit, &endFastLap);
	initScreenItem(&endRaceItems[3], 10, 30, 20, redrawDigit, &endTireTempFL);
	initScreenItem(&endRaceItems[4], 10, 30, 20, redrawDigit, &endTireTempFR);
	initScreenItem(&endRaceItems[5], 10, 30, 20, redrawDigit, &endTireTempRL);
	initScreenItem(&endRaceItems[6], 10, 30, 20, redrawDigit, &endTireTempRR);
	initScreenItem(&endRaceItems[3], 10, 30, 20, redrawTireTemp, &endTireTempFL);
	initScreenItem(&endRaceItems[4], 10, 30, 20, redrawTireTemp, &endTireTempFR);
	initScreenItem(&endRaceItems[5], 10, 30, 20, redrawTireTemp, &endTireTempRL);
	initScreenItem(&endRaceItems[6], 10, 30, 20, redrawTireTemp, &endTireTempRR);
	initScreenItem(&endRaceItems[7], 10, 30, 20, redrawDigit, &endAmbientTemp);
	initScreenItem(&endRaceItems[8], 10, 30, 20, redrawDigit, &endFuelConsum);

	allScreens[CHASSIS_SCREEN] = &chassisScreen;
	chassisScreen.items = chassisItems;
	chassisScreen.len = 20;
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawDigit, &ttFL);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawDigit, &ttFR);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawDigit, &ttRL);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawDigit, &ttRR);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawTireTemp, ttFLA);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawTireTemp, ttFRA);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawTireTemp, ttRLA);
	initScreenItem(&chassisItems[0], 10, 30, 20, redrawTireTemp, ttRRA);
    
    //brake screen
    allScreens[BRAKE_SCREEN] = &brakeScreen;
    brakeScreen.items = brakeItems;
    brakeScreen.len = 8;
    initScreenItem(&brakeItems[0], 20, 180, 30, redrawDigit, &brakePressFront);
    initScreenItem(&brakeItems[1], 360, 180, 30, redrawDigit, &brakePressRear);
    initScreenItem(&brakeItems[2], 80, 60, 20, redrawDigit, &brakeMinFront);
    initScreenItem(&brakeItems[3], 80, 100, 20, redrawDigit, &brakeMaxFront);
    initScreenItem(&brakeItems[4],360, 60, 20, redrawDigit, &brakeMinRear);
    initScreenItem(&brakeItems[5], 360, 100, 20, redrawDigit, &brakeMaxRear);
    initScreenItem(&brakeItems[6], 190, 40, 20, redrawBrakeBar, &brakePressFront);
    initScreenItem(&brakeItems[7], 250, 40, 20, redrawBrakeBar, &brakePressRear);
    

	// Lap Time Stuff
	lapTimeHead = 0;
	numLaps = 0;
	int i;
	for(i=0;i<20;i++){
		initDataItem(&(lapTimeBuffer[i]),0,0,1000,2,1);
		lapTimeBuffer[i].value = -1;
	}

	// error Stuff
	errBufferHead = 0;
	errBufferTail = 0;
	for(i=0;i<20;i++){
		errBuffer[i].errText = 0x0;
		errBuffer[i].item = 0x0;
		errBuffer[i].priority = 0;
	}
}