MembersPage/SamiKorhonen/NewFirmwaretoVerTwo (2005-05-15 09:19:36)

I started to solve new firmware problems to ver2. Only few new ifdefs is needed so firmware compiles. I haven't tested these but if someone could confirm my changes so it doesn't break anything else. I made these changes to mt-RC2 packet.

for comm.c \n

uint8_t getMCPdataHIGH(uint8_t i) {

	uint16_t t;
	uint8_t r = 0;
#ifdef GENBOARDv3	//add this

	if(i < 8) {
		t = mcp3208_data[i];
		if (t != 0xffff) 
	//		r = (uint8_t) t >> 8;
			r = t >> 8;
	}
#endif	// add this
	
	return r;	
}
\n
uint8_t getMCPdataLOW(uint8_t i) {

	uint16_t t;
	uint8_t r = 0;

#ifdef GENBOARDv3	//add this

	if(i < 8) {
		t = mcp3208_data[i];
		if (t != 0xffff) 
			r = (uint8_t) t & 0xFF;
		read_mcp3208(i);
	}
#endif //add this	
	
	return r;	
}

for fuel calc.c\n

void fill_all_squirters(uint16_t pw)
{
....
		// TODO: check if gcc adds sizeof...
	} while(i);

#ifdef GENBOARDv3	//add this

#ifdef INJECTOR_STAGING
	// Calculating pulsewidth of secondary injectors
	uint16_t pw2;
	if(engine.tps >= config.inj_stage2_start_tps &&
		engine_kpa8() >= config.inj_stage2_start_map)
		pw2 = mult16_16(pw, (uint16_t)(config.inj_stage2_rate) + 256)>>8; // effectively (256 + 256) / 256
	else
		pw2 = 0;
	i=SECONDARY_INJ_CHANNELS_NUM;
	while(i)
	{
		i--;
		cli();
		inj_port_p->pwm_delay = t;
		inj_port_p->pwcalc = pw2;
		sei();
		inj_port_p++;
		// TODO: check if gcc adds sizeof...
	}
#endif	

	// calculate injector bitmask used when firing all injectors simultaneously
	i = config.alternate & 0x0f;
	mask = injport_map(i);
	while(i) {
		i--;
		mask |= injport_map(i);
	}
	engine.injector_bitmask = mask;
#endif //add this

}