//**********************************************************************
define appv 'Motor V1.02' //
//**********************************************************************
//
//
vmthread MAIN // void MAIN(void)
{ // {
DATA8 ShowVersion //
//
UI_BUTTON(PRESSED,RIGHT_BUTTON,ShowVersion) // UI_BUTTON(PRESSED,RIGHT_BUTTON,ShowVersion)
JR_FALSE(ShowVersion,DontShowVersion) // if (ShowVersion)
// {
UI_DRAW(FILLRECT,BG_COLOR,4,50,170,28) // UI_DRAW(FILLRECT,BG_COLOR,4,50,170,28)
UI_DRAW(RECT,FG_COLOR,6,52,166,24) // UI_DRAW(RECT,FG_COLOR,6,52,166,24)
UI_DRAW(TEXT,FG_COLOR,13,60,appv) // UI_DRAW(TEXT,FG_COLOR,13,60,appv)
UI_DRAW(UPDATE) // UI_DRAW(UPDATE)
//
ShowVersionWait: // do
// {
UI_BUTTON(PRESSED,RIGHT_BUTTON,ShowVersion) // UI_BUTTON(PRESSED,RIGHT_BUTTON,ShowVersion)
// }
JR_TRUE(ShowVersion,ShowVersionWait) // while (ShowVersion)
//
UI_BUTTON(FLUSH) // UI_BUTTON(FLUSH)
DontShowVersion: // }
//
UI_DRAW(RESTORE,0) // UI_DRAW(RESTORE,0)
UI_DRAW(TOPLINE,0) // UI_DRAW(TOPLINE,0)
UI_WRITE(LED,LED_GREEN) // UI_WRITE(LED,LED_GREEN)
//
CALL(TestMotors) // TestMotors()
//
UI_DRAW(TOPLINE,1) // UI_DRAW(TOPLINE,1)
} // }
//
//
subcall TestMotors // void TestMotors(void)
{ // {
DATA8 Run //
DATA8 Tmp //
DATA8 Busy //
//
//
UI_DRAW(FILLWINDOW,0x00,0,0 // UI_DRAW(FILLWINDOW,0x00,0,0
UI_DRAW(SELECT_FONT,SMALL_FONT) // UI_DRAW(SELECT_FONT,SMALL_FONT)
UI_DRAW(TEXT,FG_COLOR,0,1,'Motors') // UI_DRAW(TEXT,FG_COLOR,0,1,'Motors')
UI_DRAW(LINE,FG_COLOR,0,TOPLINE_HEIGHT,LCD_WIDTH,TOPLINE_HEIGHT) // UI_DRAW(LINE,FG_COLOR,0,TOPLINE_HEIGHT,LCD_WIDTH,TOPLINE_HEIGHT)
UI_DRAW(SELECT_FONT,NORMAL_FONT) // UI_DRAW(SELECT_FONT,NORMAL_FONT)
//
UI_DRAW(TEXT,FG_COLOR,24,20, '4 motors plugged') //
UI_DRAW(TEXT,FG_COLOR,24,40, 'Motors should ') //
UI_DRAW(TEXT,FG_COLOR,24,60, 'ramp up and down') //
UI_DRAW(TEXT,FG_COLOR,24,80, 'forward and back') //
UI_DRAW(TEXT,FG_COLOR,24,100,'ward one by one ') //
UI_DRAW(UPDATE) //
//
OUTPUT_STEP_POWER(0,1,100,360,0,360,1) // OUTPUT_STEP_POWER(0,1,100,360,0,360,1)
// do
Loop11: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,1,Busy) // OUTPUT_TEST(0,1,Busy)
// }
JR_TRUE(Busy,Loop11) // while (Busy)
//
OUTPUT_STEP_POWER(0,1,-100,360,0,360,1) // OUTPUT_STEP_POWER(0,1,-100,360,0,360,1)
// do
Loop12: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,1,Busy) // OUTPUT_TEST(0,1,Busy)
// }
JR_TRUE(Busy,Loop12) // while (Busy)
//
//
OUTPUT_STEP_POWER(0,2,100,360,0,360,1) // OUTPUT_STEP_POWER(0,2,100,360,0,360,1)
// do
Loop21: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,2,Busy) // OUTPUT_TEST(0,2,Busy)
// }
JR_TRUE(Busy,Loop21) // while (Busy)
//
OUTPUT_STEP_POWER(0,2,-100,360,0,360,1) // OUTPUT_STEP_POWER(0,2,-100,360,0,360,1)
// do
Loop22: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,2,Busy) // OUTPUT_TEST(0,2,Busy)
// }
JR_TRUE(Busy,Loop22) // while (Busy)
//
//
OUTPUT_STEP_POWER(0,4,100,360,0,360,1) // OUTPUT_STEP_POWER(0,4,100,360,0,360,1)
// do
Loop31: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,4,Busy) // OUTPUT_TEST(0,4,Busy)
// }
JR_TRUE(Busy,Loop31) // while (Busy)
//
OUTPUT_STEP_POWER(0,4,-100,360,0,360,1) // OUTPUT_STEP_POWER(0,4,-100,360,0,360,1)
// do
Loop32: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,4,Busy) // OUTPUT_TEST(0,4,Busy)
// }
JR_TRUE(Busy,Loop32) // while (Busy)
//
//
OUTPUT_STEP_POWER(0,8,100,360,0,360,1) // OUTPUT_STEP_POWER(0,8,100,360,0,360,1)
// do
Loop41: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,8,Busy) // OUTPUT_TEST(0,8,Busy)
// }
JR_TRUE(Busy,Loop41) // while (Busy)
//
OUTPUT_STEP_POWER(0,8,-100,360,0,360,1) // OUTPUT_STEP_POWER(0,8,-100,360,0,360,1)
// do
Loop42: // {
UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp) // UI_BUTTON(SHORTPRESS,ENTER_BUTTON,Tmp)
JR_TRUE(Tmp,Stop) // break out and goto stop
OUTPUT_TEST(0,8,Busy) // OUTPUT_TEST(0,8,Busy)
// }
JR_TRUE(Busy,Loop42) // while (Busy)
Stop: //
UI_BUTTON(FLUSH) // UI_BUTTON(FLUSH)
} // }
//
//
//!