diff --git a/applications/v2.3/HandleDownKey.c b/applications/v2.3/HandleDownKey.c index 5481f93..ab4594b 100644 --- a/applications/v2.3/HandleDownKey.c +++ b/applications/v2.3/HandleDownKey.c @@ -540,12 +540,12 @@ void HandleDownKey(void) if (bData_40002c1a == 1) { //5bd78 - SlewRaw(2, 2, g_eSlewRateIndex); + SlewAxis(2, 2, g_eSlewRateIndex); } else { //0x5bd90 - SlewRaw(4, 2, g_eSlewRateIndex); + SlewAxis(4, 2, g_eSlewRateIndex); } } } @@ -555,12 +555,12 @@ void HandleDownKey(void) if (bData_40002c1a == 1) { //5bdb8 - SlewRaw(2, 2, g_eSlewRateIndex); + SlewAxis(2, 2, g_eSlewRateIndex); } else { //0x5bdd0 - SlewRaw(4, 2, g_eSlewRateIndex); + SlewAxis(4, 2, g_eSlewRateIndex); } } //->0x5ca8c @@ -572,13 +572,13 @@ void HandleDownKey(void) if (bData_40002c1a == 1) { //5be0c - SlewRaw(2, 2, 3); + SlewAxis(2, 2, SLEW_RATE_8X); bData_40002edd = 3; } else { //0x5be2c - SlewRaw(4, 2, 3); + SlewAxis(4, 2, SLEW_RATE_8X); bData_40002edd = 1; } iBacklashCorrectionSlewing = 1; @@ -593,12 +593,12 @@ void HandleDownKey(void) if (bData_40002c1a == 1) { //5be90 - SlewRaw(2, 2, 3); + SlewAxis(2, 2, SLEW_RATE_8X); } else { //0x5bea4 - SlewRaw(4, 2, 3); + SlewAxis(4, 2, SLEW_RATE_8X); } } //5beb4 -> 0x5ca8c diff --git a/applications/v2.3/HandleLeftKey.c b/applications/v2.3/HandleLeftKey.c index 445903f..bcd558a 100644 --- a/applications/v2.3/HandleLeftKey.c +++ b/applications/v2.3/HandleLeftKey.c @@ -943,13 +943,13 @@ void HandleLeftKey(void) if (bData_40002c1a == 1) { //599b0 - SlewRaw(1, 3, g_eSlewRateIndex); + SlewAxis(1, 3, g_eSlewRateIndex); //->0x59a1c } else { //0x599c8 - SlewRaw(3, 3, g_eSlewRateIndex); + SlewAxis(3, 3, g_eSlewRateIndex); //->0x59a1c } } @@ -960,12 +960,12 @@ void HandleLeftKey(void) if (bData_40002c1a == 1) { //599f0 - SlewRaw(1, 3, g_eSlewRateIndex); + SlewAxis(1, 3, g_eSlewRateIndex); } else { //0x59a08 - SlewRaw(3, 3, g_eSlewRateIndex); + SlewAxis(3, 3, g_eSlewRateIndex); } } //-> 0x59dc4 @@ -989,14 +989,14 @@ void HandleLeftKey(void) if (bData_40002c1a == 1) { //59a74 - SlewRaw(1, 3, SLEW_RATE_8X); //3); + SlewAxis(1, 3, SLEW_RATE_8X); //3); bData_40002edd = 2; } else { //0x59a94 - SlewRaw(3, 3, SLEW_RATE_8X); //3); + SlewAxis(3, 3, SLEW_RATE_8X); //3); bData_40002edd = 0; } @@ -1014,12 +1014,12 @@ void HandleLeftKey(void) if (bData_40002c1a == 1) { //59afc - SlewRaw(1, 3, g_eSlewRateIndex); + SlewAxis(1, 3, g_eSlewRateIndex); } else { //0x59b14 - SlewRaw(3, 3, g_eSlewRateIndex); + SlewAxis(3, 3, g_eSlewRateIndex); } } //0x59b28 -> 0x59dc4 diff --git a/applications/v2.3/HandleRightKey.c b/applications/v2.3/HandleRightKey.c index 44ec373..6708fbc 100644 --- a/applications/v2.3/HandleRightKey.c +++ b/applications/v2.3/HandleRightKey.c @@ -1013,12 +1013,12 @@ void HandleRightKey(void) if (bData_40002c1a == 1) { //57f2c - SlewRaw(1, 4, g_eSlewRateIndex); + SlewAxis(1, 4, g_eSlewRateIndex); } else { //0x57f44 - SlewRaw(3, 4, g_eSlewRateIndex); + SlewAxis(3, 4, g_eSlewRateIndex); } } } @@ -1028,12 +1028,12 @@ void HandleRightKey(void) if (bData_40002c1a == 1) { //57f6c - SlewRaw(1, 4, g_eSlewRateIndex); + SlewAxis(1, 4, g_eSlewRateIndex); } else { //0x57f84 - SlewRaw(3, 4, g_eSlewRateIndex); + SlewAxis(3, 4, g_eSlewRateIndex); } } //0x57f98 -> 0x583d0 @@ -1055,14 +1055,14 @@ void HandleRightKey(void) if (bData_40002c1a == 1) { //57ff0 - SlewRaw(1, 4, SLEW_RATE_8X); //3); + SlewAxis(1, 4, SLEW_RATE_8X); //3); bData_40002edd = 2; } else { //0x58010 - SlewRaw(3, 4, SLEW_RATE_8X); //3); + SlewAxis(3, 4, SLEW_RATE_8X); //3); bData_40002edd = 0; } @@ -1080,12 +1080,12 @@ void HandleRightKey(void) if (bData_40002c1a == 1) { //58074 - SlewRaw(1, 4, g_eSlewRateIndex); + SlewAxis(1, 4, g_eSlewRateIndex); } else { //0x58120 - SlewRaw(3, 4, g_eSlewRateIndex); + SlewAxis(3, 4, g_eSlewRateIndex); } } //0x58134 diff --git a/applications/v2.3/HandleUpKey.c b/applications/v2.3/HandleUpKey.c index 8a24954..e91a50f 100644 --- a/applications/v2.3/HandleUpKey.c +++ b/applications/v2.3/HandleUpKey.c @@ -820,12 +820,12 @@ void HandleUpKey(void) if (bData_40002c1a == 1) { //5e3d4 - SlewRaw(2, 1, g_eSlewRateIndex); + SlewAxis(2, 1, g_eSlewRateIndex); } else { //0x5e3ec - SlewRaw(4, 1, g_eSlewRateIndex); + SlewAxis(4, 1, g_eSlewRateIndex); } } } @@ -835,12 +835,12 @@ void HandleUpKey(void) if (bData_40002c1a == 1) { //5e414 - SlewRaw(2, 1, g_eSlewRateIndex); + SlewAxis(2, 1, g_eSlewRateIndex); } else { //0x5e42c - SlewRaw(4, 1, g_eSlewRateIndex); + SlewAxis(4, 1, g_eSlewRateIndex); } } //0x5e440 -> 0x5f0b4 @@ -853,14 +853,14 @@ void HandleUpKey(void) if (bData_40002c1a == 1) { //5e468 - SlewRaw(2, 1, SLEW_RATE_8X); + SlewAxis(2, 1, SLEW_RATE_8X); bData_40002edd = 3; } else { //0x5e488 - SlewRaw(4, 1, SLEW_RATE_8X); + SlewAxis(4, 1, SLEW_RATE_8X); bData_40002edd = 1; } @@ -878,12 +878,12 @@ void HandleUpKey(void) if (bData_40002c1a == 1) { //5e414 - SlewRaw(2, 1, SLEW_RATE_8X); + SlewAxis(2, 1, SLEW_RATE_8X); } else { //0x5e504 - SlewRaw(4, 1, SLEW_RATE_8X); + SlewAxis(4, 1, SLEW_RATE_8X); } } //0x5e514 diff --git a/applications/v2.3/data.c b/applications/v2.3/data.c index c1c2e17..233bec8 100644 --- a/applications/v2.3/data.c +++ b/applications/v2.3/data.c @@ -406,12 +406,12 @@ char bData_4000319b; //4000319b char g_bSingleSlewActive; //4000319c char g_bCombinedSlewActive; //4000319d Union_400031a0 Data_400031a0; //400031a0 -Union_400031a0 Data_400031a4; //400031a4 +Union_400031a0 g_stCurrentSlewRampValue; //400031a4 int Data_400031a8; //400031a8 Union_400031a0 Data_400031ac; //400031ac int fill_400031b0; //400031b0 -int Data_400031b4; //400031b4 -char bData_400031b8; //400031b8 +int g_iCurrentSlewRampIndex; //400031b4 +char g_bMaxSlewRampActive; //400031b8 char bData_400031b9; //400031b9 char bData_400031ba; //400031ba char bData_400031bb; //400031bb diff --git a/applications/v2.3/data.h b/applications/v2.3/data.h index 7704086..3cbb3a4 100644 --- a/applications/v2.3/data.h +++ b/applications/v2.3/data.h @@ -583,11 +583,11 @@ extern char bData_4000319b; //4000319b extern char g_bSingleSlewActive; //4000319c extern char g_bCombinedSlewActive; //4000319d extern Union_400031a0 Data_400031a0; //400031a0 -extern Union_400031a0 Data_400031a4; //400031a4 +extern Union_400031a0 g_stCurrentSlewRampValue; //400031a4 extern int Data_400031a8; //400031a8 extern Union_400031a0 Data_400031ac; //400031ac -extern int Data_400031b4; //400031b4 -extern char bData_400031b8; //400031b8 +extern int g_iCurrentSlewRampIndex; //400031b4 +extern char g_bMaxSlewRampActive; //400031b8 extern char bData_400031b9; //400031b9 extern char bData_400031ba; //400031ba extern char bData_400031bb; //400031bb diff --git a/applications/v2.3/file_5099c.c b/applications/v2.3/file_5099c.c index 05b15eb..8d76e21 100644 --- a/applications/v2.3/file_5099c.c +++ b/applications/v2.3/file_5099c.c @@ -39,7 +39,7 @@ void func_5099c(void) bData_400032a4_OTAZeroDataErrorCount = 0; bData_4000319b = 0; bData_400031e9 = 0; - bData_400031b8 = 0; + g_bMaxSlewRampActive = 0; bData_400031b9 = 0; Data_40002e80 = 0; Data_40002e84 = 0; diff --git a/applications/v2.3/main.c b/applications/v2.3/main.c index 7cfe35f..5c62c3a 100644 --- a/applications/v2.3/main.c +++ b/applications/v2.3/main.c @@ -1568,16 +1568,16 @@ void SlewStop(void) uart1_write_byte(0); bTrackingMode = MENU_TRACKING_MODE_STOP; //0; - } + } //if (g_eSlewRateIndex != SLEW_RATE_MAX) //9) else { //0x5f1c8 - if (Data_400031a4.Data >= 4800) + if (g_stCurrentSlewRampValue.Data >= 4800) { - Data_400031a4.Data = 4700; + g_stCurrentSlewRampValue.Data = 4700; } //0x5f1e4 - Data_400031b4 = -4; + g_iCurrentSlewRampIndex = -4; // Ramp down (-1200) } } } @@ -4610,24 +4610,24 @@ int main(void) bData_400034cc = 0; } //6f970 - if ((bData_400031b8 != 0) && (Data_400031a4.Data <= 4800)) + if ((g_bMaxSlewRampActive != 0) && (g_stCurrentSlewRampValue.Data <= 4800)) { //6f990 - if (Data_400031a4.Data < 4800) + if (g_stCurrentSlewRampValue.Data < 4800) { - if (Data_400031b4 == 1) + if (g_iCurrentSlewRampIndex == 1) { - //6f9b0 - Data_400031a4.Data = Data_400031a4.Data + Data_400031b4 * 100; + //6f9b0: Ramp up (+100) + g_stCurrentSlewRampValue.Data += g_iCurrentSlewRampIndex * 100; } else { //0x6f9d8 - Data_400031a4.Data = Data_400031a4.Data + Data_400031b4 * 300; + g_stCurrentSlewRampValue.Data += g_iCurrentSlewRampIndex * 300; } } //0x6f9fc - if (Data_400031a4.Data >= 2560) + if (g_stCurrentSlewRampValue.Data >= 2560) { //6fa0c if (bData_400031bc == 1) @@ -4661,14 +4661,14 @@ int main(void) uart1_write_byte(0x22); //Send DEC? } //0x6faa8 - uart1_write_byte(Data_400031a4.bData[1]); - uart1_write_byte(Data_400031a4.bData[0]); + uart1_write_byte(g_stCurrentSlewRampValue.bData[1]); + uart1_write_byte(g_stCurrentSlewRampValue.bData[0]); uart1_write_byte(Data_400031ac.bData[3]); uart1_write_byte(Data_400031ac.bData[2]); uart1_write_byte(Data_400031ac.bData[1]); } //0x6fb24 - } //if (Data_400031a4.Data >= 2560) + } //if (g_stCurrentSlewRampValue.Data >= 2560) else { //0x6fae8 @@ -4679,9 +4679,9 @@ int main(void) uart1_write_byte(0x00); bTrackingMode = MENU_TRACKING_MODE_STOP; //0; - bData_400031b8 = 0; + g_bMaxSlewRampActive = 0; } - } //if ((bData_400031b8 != 0) && (Data_400031a4.Data <= 4800)) + } //if ((g_bMaxSlewRampActive != 0) && (g_stCurrentSlewRampValue.Data <= 4800)) //6fb24 if (bTrackingMode == MENU_TRACKING_MODE_TRACKING/*2*/) { @@ -5342,13 +5342,13 @@ int main(void) if (bRaBacklashCorrectionDirection == 2) { //72474 - SlewRaw(3, 4, 1); + SlewAxis(3, 4, SLEW_RATE_1X); } //72484 if (bRaBacklashCorrectionDirection == 1) { //72494 - SlewRaw(3, 3, 1); + SlewAxis(3, 3, SLEW_RATE_1X); } //724a4 func_659c(10); @@ -5388,13 +5388,13 @@ int main(void) if (bDecBacklashCorrectionDirection == 2) { //72628 - SlewRaw(4, 2, 1); + SlewAxis(4, 2, SLEW_RATE_1X); } //72638 if (bDecBacklashCorrectionDirection == 1) { //72648 - SlewRaw(4, 1, 1); + SlewAxis(4, 1, SLEW_RATE_1X); } //72658 func_659c(10); @@ -5420,12 +5420,12 @@ int main(void) //7273c if (bRaBacklashCorrectionDirection == 2) { - SlewRaw(1, 4, 2); + SlewAxis(1, 4, SLEW_RATE_2X); } if (bRaBacklashCorrectionDirection == 1) { - SlewRaw(1, 3, 2); + SlewAxis(1, 3, SLEW_RATE_2X); } func_659c(10); @@ -5450,12 +5450,12 @@ int main(void) //728a0 if (bDecBacklashCorrectionDirection == 2) { - SlewRaw(2, 2, 2); + SlewAxis(2, 2, SLEW_RATE_2X); } if (bDecBacklashCorrectionDirection == 1) { - SlewRaw(2, 1, 2); + SlewAxis(2, 1, SLEW_RATE_2X); } func_659c(10); diff --git a/applications/v2.3/slew1.c b/applications/v2.3/slew1.c index 09b9519..bb9c3a2 100644 --- a/applications/v2.3/slew1.c +++ b/applications/v2.3/slew1.c @@ -1,7 +1,7 @@ /* 57414 - todo */ -void SlewRaw(int axis, int direction, int speed) +void SlewAxis(int axis, int direction, int speed) { unsigned char i; char sp12[12]; @@ -196,11 +196,13 @@ void SlewRaw(int axis, int direction, int speed) //0x577e0 sp12[6] = 0x0a; sp12[7] = 0x00; //2560 - Data_400031a4.Data = 2560; - bData_400031b8 = 1; + g_stCurrentSlewRampValue.Data = 2560; + + g_bMaxSlewRampActive = 1; bData_400031ba = sp12[4]; bData_400031bc = sp12[5]; - Data_400031b4 = 1; + g_iCurrentSlewRampIndex = 1; //Ramp up (+100) + bData_400031b9 = 0; bData_400031bb = sp12[4]; bData_400031bd = sp12[5];