Skip to content

Commit

Permalink
freertos_app: add macro UART1_WRITE_HEADER
Browse files Browse the repository at this point in the history
  • Loading branch information
Spitzbube committed Feb 7, 2021
1 parent c99a584 commit d5e4963
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 104 deletions.
10 changes: 2 additions & 8 deletions applications/freertos_app/HandleEnterKey.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,10 +1045,7 @@ void HandleEnterKey(void)

Data_40003500.dwData = fabs((int) ((6.0 * dTrackingRate) / 15.04));

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x04);
UART1_WRITE_HEADER(4);
uart1_write_byte(0x41);

if (dTrackingRate > 0)
Expand All @@ -1065,10 +1062,7 @@ void HandleEnterKey(void)
uart1_write_byte(Data_40003500.bData[1]);
uart1_write_byte(Data_40003500.bData[0]);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x04);
UART1_WRITE_HEADER(4);
uart1_write_byte(0x01);

if (dTrackingRate > 0)
Expand Down
35 changes: 7 additions & 28 deletions applications/freertos_app/file_1f30.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,10 +2296,7 @@ void func_65d4(double sp40, double sp48)
//6d64
} //if (g_iSlewStepRaAxis != 0)
//6d68
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(1 + 2 + 3);
UART1_WRITE_HEADER(1 + 2 + 3);
uart1_write_byte(0x02); //Send RA?
uart1_write_byte(Data_400033cc.bData[1]);
uart1_write_byte(Data_400033cc.bData[0]);
Expand Down Expand Up @@ -2373,10 +2370,7 @@ void func_65d4(double sp40, double sp48)
Data_400033cc.dwData = 980;
}
//6f08
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x06);
UART1_WRITE_HEADER(6);
uart1_write_byte(0x42);
uart1_write_byte(Data_400033cc.bData[1]);
uart1_write_byte(Data_400033cc.bData[0]);
Expand Down Expand Up @@ -2518,10 +2512,7 @@ void func_65d4(double sp40, double sp48)
}
}
//7390
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(1 + 2 + 3);
UART1_WRITE_HEADER(1 + 2 + 3);
uart1_write_byte(0x22); //Send DEC?
uart1_write_byte(Data_400033cc.bData[1]);
uart1_write_byte(Data_400033cc.bData[0]);
Expand Down Expand Up @@ -2595,10 +2586,7 @@ void func_65d4(double sp40, double sp48)
Data_400033cc.dwData = 980;
}

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x06);
UART1_WRITE_HEADER(6);
uart1_write_byte(0x62);
uart1_write_byte(Data_400033cc.bData[1]);
uart1_write_byte(Data_400033cc.bData[0]);
Expand All @@ -2614,10 +2602,7 @@ void func_65d4(double sp40, double sp48)
/* 7590 - complete */
void func_7590(void)
{
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0xff);
}

Expand Down Expand Up @@ -4004,10 +3989,7 @@ void StopSlewing(void)
Data_40004128.dData_304 = 0.0;
bTrackingMode = MENU_TRACKING_MODE_STOP; //0;

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x00);

Data_40004128.alignmentPause = 1;
Expand All @@ -4020,10 +4002,7 @@ void ResumeSlewing(void)
{
Data_40004128.bTrackingRequest = 1;

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0xFF);

Data_40004128.alignmentPause = 0;
Expand Down
6 changes: 6 additions & 0 deletions applications/freertos_app/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
((int)a), ((int)((a - (int)a) * 60))


#define UART1_WRITE_HEADER(len) \
uart1_write_byte(0x55); \
uart1_write_byte(0xaa); \
uart1_write_byte(0x01); \
uart1_write_byte(len);

80 changes: 16 additions & 64 deletions applications/freertos_app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,28 +254,16 @@ void HandleReset(void)
func_d2cc();
func_5099c();

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x44);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x64);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x04);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x24);

func_659c(10);
Expand Down Expand Up @@ -869,10 +857,7 @@ double func_52720(int a)
char b[4];
} sp8;

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x03);
UART1_WRITE_HEADER(3);

switch (a)
{
Expand Down Expand Up @@ -1537,10 +1522,7 @@ void SlewStop(void)
//0x5f0e4
if (g_bCombinedSlewActive == 1)
{
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0);

bTrackingMode = MENU_TRACKING_MODE_STOP; //0;
Expand All @@ -1550,10 +1532,7 @@ void SlewStop(void)
{
if (bData_40002c1a == 2)
{
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0);

bTrackingMode = MENU_TRACKING_MODE_STOP; //0;
Expand All @@ -1563,10 +1542,7 @@ void SlewStop(void)
//0x5f180
if (g_eSlewRateIndex != SLEW_RATE_MAX) //9)
{
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0);

bTrackingMode = MENU_TRACKING_MODE_STOP; //0;
Expand Down Expand Up @@ -3054,10 +3030,7 @@ double func_6ab74(int a)

bData_40002c13_uart1ReceiveComplete = 0;

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);

switch (a)
{
Expand Down Expand Up @@ -3275,10 +3248,7 @@ void ReceiveMountAutoguideValues(void)
iMountAutoguideDec = 0;
bData_40002c13_uart1ReceiveComplete = 0;

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x81);

bData_40002c13_uart1ReceiveComplete = 0;
Expand Down Expand Up @@ -4017,28 +3987,16 @@ static void vMainTask(void *pvParameters)

ShowStartupScreen();

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x44);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x64);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x04);

uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(1);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x24);

func_659c(10); //delay
Expand Down Expand Up @@ -4784,10 +4742,7 @@ static void vMainTask(void *pvParameters)
if (g_bCombinedSlewActive != 1)
{
//6fa58
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(1 + 2 + 3);
UART1_WRITE_HEADER(1 + 2 + 3);

if (bData_400031ba == 0x01)
{
Expand All @@ -4812,10 +4767,7 @@ static void vMainTask(void *pvParameters)
else
{
//0x6fae8
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(1);
UART1_WRITE_HEADER(1);
uart1_write_byte(0x00);

bTrackingMode = MENU_TRACKING_MODE_STOP; //0;
Expand Down
5 changes: 1 addition & 4 deletions applications/freertos_app/slew2.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,7 @@ void SlewBothAxes(int a, int b, int speed1, int d, int e, int speed2)

if (g_bSingleSlewActive == 0)
{
uart1_write_byte(0x55);
uart1_write_byte(0xaa);
uart1_write_byte(0x01);
uart1_write_byte(0x01);
UART1_WRITE_HEADER(1);
uart1_write_byte(0xff);
}
}
Expand Down

0 comments on commit d5e4963

Please sign in to comment.