Leihlo le Bohlale le Thehiloe ho Skrine se chitja sa DWIN

——Ho tsoa ho Foramo ea Baetsi ba DWIN

Morero oa mohloli o bulehileng oa sethala sa DWIN o khothalelitsoeng motho e mong le e mong nakong ena ke mokhoa o khahlisang haholo oa ho etsisa motsamao oa mahlo a motho.Moenjiniere o sebelisitse lisebelisoa tse 'maloa tsa litšoantšo tsa mahlo a motho ho hlokomela mesebetsi e kang ho sisinyeha ha leihlo, ho panya, ho lemoha sefahleho le ho latela.

Kenyelletso ea litharollo tsa mohloli o bulehileng:

1. Boitsebiso ba setšoantšo sa UI

Tsebiso ea Mohlophisi: Skrine e bohlale ea DWIN e ipapisitse le litšoantšo ho phethela nts'etsopele ea UI, e ka hlokomelang litlamorao tse fapaneng habonolo.

dytrgf (1)

2. Nts'etsopele ea li-interface

Ho bonolo ho nts'etsapele sebopeho ka software ea DGUS, 'me ho hlokahala litsamaiso tse peli feela tsa litšoantšo.Ketsahalong ena, moenjiniere o ile a khetha skrine e bohlale ea 2.1-inch.

dytrgf (2)

3. Lemoha panya animation

E re litšoantšo tsa lintši li hlahisoe ka nako e itseng:

// Papadi ya panya

void blink_animat(feela)

{

haeba(blink_flag == 0)

{

blink_cnt++;

haeba(blink_cnt >= 4)

{

blink_flag = 1;

}

}

tse ling

{

blink_cnt–;

haeba(blink_cnt <= 0)

{

blink_flag = 0;

}

}

write_dgus_vp(0×3000, (u8 *)&blink_cnt, 2);

}

blink_run e se nang letho()

{

static u32 run_timer_cnt = 0;

run_timer_cnt++;

haeba(run_timer_cnt >= 2000000)

{

run_timer_cnt = 0;

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

blink_animat();

Delay_ms(30);

}

}

4. Lemoha hore mahlo a mahlo a shebahala ka ho le letšehali le ka ho le letona ka tlhaho.

Sena se tšoana le ho panya, empa se hloka ho bapisa nako ea kristale oscillator ho laola motsamao oa mahlo.Kamora makhetlo a mangata a ho lokisa liphoso, moenjiniere o ile a theha sete e latelang ea likhoutu.

//Papadi ya bolo ya mahlo

void eyeball_animat(lefela)

{

eyeball_timer_cnt++;

haeba(eyeball_timer_cnt <50)

{

eyeball_cnt = 20;

}

ho seng joalo (eyeball_timer_cnt <51)

{

eyeball_cnt = 50;

}

ho seng joalo (eyeball_timer_cnt <52)

{

eyeball_cnt = 80;

}

ho seng joalo (eyeball_timer_cnt <53)

{

leihlo_cnt = 94;

}

ho seng joalo (eyeball_timer_cnt <103)

{

leihlo_cnt = 94;

}

ho seng joalo (eyeball_timer_cnt <104)

{

eyeball_cnt = 80;

}

ho seng joalo (eyeball_timer_cnt <105)

{

eyeball_cnt = 50;

}

ho seng joalo (eyeball_timer_cnt <106)

{

eyeball_cnt = 20;

}

ho seng joalo (eyeball_timer_cnt < 107)

{

eyeball_cnt = -10;

}

ho seng joalo (eyeball_timer_cnt < 108)

{

leihlo_cnt = -40;

}

ho seng joalo (eyeball_timer_cnt <158)

{

leihlo_cnt = -54;

}

ho seng joalo (eyeball_timer_cnt <159)

{

leihlo_cnt = -40;

}

ho seng joalo (eyeball_timer_cnt <160)

{

eyeball_cnt = -10;

}

ho seng joalo (eyeball_timer_cnt <161)

{

eyeball_cnt = 20;

eyeball_timer_cnt = 0;

}

//Suthela ho le letshehadi le ho le letona

// haeba(leihlo_folakha == 0)

// {

// eyeball_cnt++;

// haeba(bolo_cnt >= 94)

// {

// eyeball_flag = 1;

// }

// }

// tse ding

// {

// leihlo_cnt–;

// haeba(eyeball_cnt <= -54)

// {

// eyeball_flag = 0;

// }

// }

haeba(eyeball_cnt >= 0)

{

leihlo_pos[0] = 0×00;

eyeball_pos[1] = eyeball_cnt;

}

tse ling

{

leihlo_pos[0] = 0xFF;

eyeball_pos[1] = (eyeball_cnt & 0xFF);

}

write_dgus_vp(0×3111, (u8 *)&eyeball_pos, 2);

}

sekheo sa leihlo_run()

{

static u32 run_timer_cnt = 0;

run_timer_cnt++;

haeba(run_timer_cnt >= 20000)

{

run_timer_cnt = 0;

eyeball_animat();

}

}

5. Eketsa ESP32 temoho ea sefahleho ho hlokomela motsamao oa mahlo a latelang sefahleho.

Mokhoa oa ts'ebetso mona ke oa hore ha sefahleho se fumanoa, mahlo ha a tsamaee a le mong, 'me ho hlalosoa ho fetoha ho eketseha ha loop ka nako.Ha increment e fihla boleng bo itseng, mahlo a mahlo a tla tsamaea a le mong.Ha sekepe sa serial se fumana data, phapang ena e tla hlakoloa, ebe e tsamaisa mahlo feela ho ea ka boemo ba sefahleho.Khoutu ea mantlha ke e latelang:

haeba(rec_data_timer_cnt <1000000)

{

rec_data_timer_cnt++;

}

tse ling

{

eyeball_run();

}

extern u32 rec_data_timer_cnt;

extern u16 eyeball_timer_cnt;

void Communication_CMD(u8 st)

{

haeba((uart[st].Rx_F==1 )&&(uart[st].Rx_T==0))

{

rec_data_timer_cnt = 0;

eyeball_timer_cnt = 0;

#haeba(Mofuta_Moqoqo==1)

Describe_8283(st);

#elif(Type_Communication==2)

Describe_Modbus(st);

#endif

uart[st].Rx_F=0;

uart[st].Rx_Num=0;

}

}


Nako ea poso: Jun-26-2023