UPA Script - Correção de KM Yamaha Fazer 600 - admin - 16-07-2020
program Prog1;
var
Code, Code_1: string;
KM: Integer;
procedure ReadKM;
begin
if not ReadDevice then
begin
MsgBox('Erro de Leitura', 'Erro', MB_OK);
end
else
begin
AddMsg('Yamaha Fazer 600 1999-2002r 93C46');
Code_1 := inttohex(GetByteHexEdit($061), 2) + inttohex(GetByteHexEdit($060), 2);
KM := (strtoint('$' + Code_1)) * 16;
AddMsg('Kilometragem Atual' + ' = ' + IntToStr(KM) + ' km');
MsgBox(IntToStr(KM) + ' km', 'KM Atual', MB_OK);
end;
end;
procedure NewKM;
var
n, new_KM, new_KM2: integer;
n1, n2, n3, n4: string;
begin
SetProgramModifiedOnly(true);
if InBox('Digite a KM', 'Nova KM', code) then
begin
end;
if StrToInt(code) > 999999 then
begin
MsgBox('Valor deve ser 000001 até 999999', 'Erro', MB_OK);
exit;
end;
n := StrToInt(code);
new_KM := (n / 16);
new_KM2 := (65535 - (n / 16));
n1 := IntToHex(new_KM, 4);
n2 := IntToHex(new_KM2, 4)
SetByteHexEdit($061, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($060, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($063, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($062, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($065, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($064, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($067, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($066, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($069, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($068, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($06B, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($06A, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($06D, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($06C, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($06F, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($06E, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($071, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($070, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($073, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($072, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($075, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($074, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($077, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($076, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($079, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($078, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($07B, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($07A, (strtoint('$' + n2[3] + n2[4])));
SetByteHexEdit($07D, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($07C, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($07F, (strtoint('$' + n2[1] + n2[2])));
SetByteHexEdit($07E, (strtoint('$' + n2[3] + n2[4])));
RefreshHexEdit;
if MsgBox('Programar?', 'Confirme', MB_YESNO) = IDYES then
begin
SetProgramModifiedOnly(true);
ProgramDevice;
VerifyDevice;
ReadKM;
end;
end;
begin
AddDeviceGroup('Bikes', 'Select a Device');
AddDevice('Yamaha Fazer 600 1999-2002r 93C46', '93c46 x 16', 'Bikes', '93C46 x16');
AddAction('Read KM', 'ReadKM', 'Yamaha Fazer 600 1999-2002r 93C46');
AddAction('New KM', 'NewKM', 'Yamaha Fazer 600 1999-2002r 93C46');
AddOpenFileAction('Dash 2002r', 'Yamaha Fazer 600 1999-2002r 93C46', 'yamaha_fazer600_2002.jpg');
AddOpenFileAction('Dash 1999r', 'Yamaha Fazer 600 1999-2002r 93C46', 'yamaha_fazer600_1999r.jpg');
AddOpenFileAction('Pinout 2002r', 'Yamaha Fazer 600 1999-2002r 93C46', 'yamaha_fazer600_2002_1.jpg');
AddOpenFileAction('Pinout 1999r', 'Yamaha Fazer 600 1999-2002r 93C46', 'yamaha_fazer600_1999r_1.jpg');
AddMsg('Sample Device Script (yamaha_fazer600_1999-2002.uds) Installed '#169' 2020 Fórum MSBig - www.msbig.net');
SetProductInfo('Yamaha Fazer 600 1999-2002r 93C46', 'Device Script Example'#$D'Copyright'#169' 2020 Fórum MSBig - www.msbig.net');
end.
Esquema para ligações:[attachment=3130][attachment=3131][attachment=3132][attachment=3133]
|