예제 #1
0
void CheckSwitches(void){

	Print_Level l = getPrintLevel();
	setPrintLevelInfoPrint();
	switched=0;
	volt = GetRawVoltage();
	BOOL up = FALSE;

	BYTE reg = isRegulated_0();
	if (bankState[0] != reg ){
		bankState[0]=reg;
		up=TRUE;
	}


	reg = isRegulated_1();
	if (bankState[1] != reg){
		bankState[1] = reg;
		up=TRUE;
	}

	if ((lastVolt>RawVoltageMin) && (volt<RawVoltageMin)){
		up=TRUE;
		lastVolt = volt;
	}
	if ((lastVolt<RawVoltageMin) && (volt>RawVoltageMin)){
		up=TRUE;
		lastVolt = volt;
	}

	if(up){
		println_I("\nVoltage on raw:   \t");
		p_fl_I(volt);

		println_I("Voltage on bank0: \t");
		p_fl_I(GetRail0Voltage());

		println_I("Voltage on bank1:\t");
		p_fl_I(GetRail1Voltage());
		println_I("Pushing upstream Power Packet bank 0: ");p_int_I(bankState[0]);print_I(" bank 1: ");p_int_I(bankState[1]);
		println_I("Power Code 0: ");p_int_I(GetRawVoltageCode(0));
		println_I("Power Code 1 : ");p_int_I(GetRawVoltageCode(1));
		println_I("Raw: ");p_fl_I(GetRawVoltage());
		UpstreamPushPowerChange();
	}
	setPrintLevel(l);
}
예제 #2
0
void DownstreamPowerChange(void) {

	LoadCorePacket(&downstreamPacketTemp);
	POWER(&downstreamPacketTemp);

	downstreamPacketTemp.use.data[2] = GetRawVoltageCode(0);
	downstreamPacketTemp.use.data[3] = GetRawVoltageCode(1);

	if (downstreamPacketTemp.use.data[0] == bankA
			&& downstreamPacketTemp.use.data[1] == bankB
			&& downstreamPacketTemp.use.data[2] == batteryCode0
			&& downstreamPacketTemp.use.data[3] == batteryCode1)
		return;
	bankA = downstreamPacketTemp.use.data[0];
	bankB = downstreamPacketTemp.use.data[1];
	batteryCode0 = downstreamPacketTemp.use.data[2];
	batteryCode1 = downstreamPacketTemp.use.data[3];

	SendPacketToCoProc(&downstreamPacketTemp);
	UpstreamPushPowerChange(bankA, bankB, GetRawVoltage(), getPowerOverRide());

}