——Na DWIN Developer Forum
I roto i tenei putanga, ka whakamohio atu matou ki a koe te keehi puna tuwhera whakawhiwhi tohu mai i te DWIN Developer Forum: Intelligent Cat Food Control System. I whakamahia e nga miihini te mata atamai DWIN ki te aro turuki i te mahana, te makuku, me te toenga o te kai ngeru, me te penapena i nga rekoata kai a te ngeru. He mea hanga motuhake ano e ratou he huinga UI ahua peita waituhi, me te patene waituhi ina pa ana te maihao, hei whakarei ake i te tirohanga tirohanga o nga urupare pa.
Kupu Whakataki:
1.UI rauemi pikitia
Ko te mata atamai a DWIN e whakaoti ana i te whakawhanaketanga UI i runga i nga pikitia, oro me etahi atu rauemi me whakarite i mua kia rite ki te ihirangi whakaatu mata.
2.Whakawhanaketanga atanga
Ka whakahokia e te rorohiko DGUS te paanga UI ma te whakakikorua i te paparanga, ka whakakotahi i nga rawa kua oti te whakarite ki te pikitia katoa i roto i te rorohiko DGUS, ka tautuhi i nga mahi whakaatu me te pa.
3. Whakatinana i nga paanga pawhiri me nga paanga oro
Ko te tuunga pa ka whiwhi ma te kaupapa 51, ka whai te awe pehi i te nekehanga o te maihao, ka tutuki hoki te awe oro apiti matua.
(1) Kimihia te waehere waahi pa me te purei ororongo:
kore te TouchDetect()
{
u16 Me[3] = 0;
u8 i = 0;
mo(i = 0;i
{
Va[i] = Read_Dgus(0x0016 + i);
mena(Va[0] == 0x5A01)
{
}
atu
{
pakaru;
}
}
if(i != 0) //Paohia tuatahi ki te tomo
{
u16 purei[2] = {0x0001, 0x4000};
touchAnimationFlag = 1;
touchAnimationCnt = 0;
touchPosX = Va[1];
touchPosY = Va[2];
write_dgus_vp(0x00A0, purei, 2);
}
}
(2) Ko te waehere mo te whakaaturanga paanga pa e whai ake nei:
kore te TouchStart()
{
if(touchAnimationFlag == 1)
{
mena(touchAnimationCnt == 0)
{
Tuhia_Dgus(0x5011, touchPosX - 100);
Tuhia_Dgus(0x5012, touchPosY - 100);
}
Tuhia_Dgus(0x5000, touchAnimationCnt);
touchAnimationCnt++;
if(touchAnimationCnt == 6)
{
touchAnimationFlag = 0;
Tuhia_Dgus(0x5011, 1024);
Tuhia_Dgus(0x5012, 600);
}
}
}
4. Ko te mahi e whai ake nei ko te whakatakoto i nga tawhā e tika ana ma te mata, katahi ka tuku i nga raraunga ki te kaiwhakahaere kai ngeru ma te ESP32 kia mohio ai koe ki te mahi whangai aunoa o te kai ngeru. Ko te waehere motuhake e whai ake nei:
//Tikina te mana patene
whakakorehia te mana_take_key_status()
{
int i = 0;
//u16 Va=Pānui_Dgus(addr);
u16 Va=Panui_Dgus(0x1000);
mena(Va != 0x0000)
{
//Swhārangi huna
if(Va == 0x0103) //Ponohia te tau o g
{
u16 whārangi whakawhiti[2] = {0x5A01, 19};
setNum = placeGramNum;
wharangi muri = 1; //Hoki ki te whārangi tūnga
Tuhia_Dgus(0x4000 + 0, huingaNum % 10);
Tuhia_Dgus(0x4000 + 2, huingaNum / 10 % 10);
Tuhia_Dgus(0x4000 + 4, huingaNum / 100 % 10);
Tuhia_Dgus(0x4000 + 6, huingaNum / 1000 % 10);
write_dgus_vp(0x0084, whārangi whakawhiti, 2);
}
atu mena(Va == 0x0102)
{
OneSendData3(placeGramNum); //Wahikai ngerukotahi
}
atu ki te(Va == 0x0101) //Tautuhi wharangi
{
u16 whārangi whakawhiti[2] = {0x5A01, 3};
mo(i = 0;i
{
mena(i == 0)
{
Write_Dgus(0x3070 + i * 0x10 + 0, Wā nāianei[i] % 10);
Write_Dgus(0x3070 + i * 0x10 + 2, Wā nāianei[i] / 10 % 10);
Write_Dgus(0x3070 + i * 0x10 + 4, Wā nāianei[i] / 100 % 10);
Write_Dgus(0x3070 + i * 0x10 + 6, Wā nāianei[i] / 1000 % 10);
}
atu
{
Write_Dgus(0x3070 + i * 0x10 + 0, Wā nāianei[i] % 10);
Write_Dgus(0x3070 + i * 0x10 + 2, Wā nāianei[i] / 10 % 10);
}
}
write_dgus_vp(0x0084, whārangi whakawhiti, 2); //Tauruhia te wharangi tautuhinga
}
atu mena(Va == 0x0100) //Rwharangi ecord
{
u16 whārangi whakawhiti[2] = {0x5A01, 2};
mo(i = 0;i
{
mena(i == 0)
{
Write_Dgus(0x2000 + i * 0x10 + 0, eatFeedList[0][i] % 10);
Write_Dgus(0x2000 + i * 0x10 + 2, eatFeedList[0][i] / 10 % 10);
Write_Dgus(0x2000 + i * 0x10 + 4, eatFeedList[0][i] / 100 % 10);
Write_Dgus(0x2000 + i * 0x10 + 6, eatFeedList[0][i] / 1000 % 10);
}
atu
{
Write_Dgus(0x2000 + i * 0x10 + 0, eatFeedList[0][i] % 10);
Write_Dgus(0x2000 + i * 0x10 + 2, eatFeedList[0][i] / 10 % 10);
}
}
write_dgus_vp(0x0084, whārangi whakawhiti, 2); //Tauruhia te wharangi rekoata
}
//Rwharangi ecord
atu ki te(Va == 0x0201) //Tuhia te wharangi wharangi o mua
{
mena(tiroEatCnt > 0)
{
lookEatCnt--;
mo(i = 0;i
{
mena(i == 0)
{
Write_Dgus(0x2000 + i * 0x10 + 0, eatFeedList[lookEatCnt][i] % 10);
Write_Dgus(0x2000 + i * 0x10 + 2, eatFeedList[lookEatCnt][i] / 10 % 10);
Write_Dgus(0x2000 + i * 0x10 + 4, eatFeedList[lookEatCnt][i] / 100 % 10);
Write_Dgus(0x2000 + i * 0x10 + 6, eatFeedList[lookEatCnt][i] / 1000 % 10);
}
atu
{
Write_Dgus(0x2000 + i * 0x10 + 0, eatFeedList[lookEatCnt][i] % 10);
Write_Dgus(0x2000 + i * 0x10 + 2, eatFeedList[lookEatCnt][i] / 10 % 10);
}
}
}
}
atu ki te(Va == 0x0202) //Tuhia te whārangi i muri mai
{
if(lookEatCnt
{
titiroEatCnt++;
mo(i = 0;i
{
mena(i == 0)
{
Write_Dgus(0x2000 + i * 0x10 + 0, eatFeedList[lookEatCnt][i] % 10);
Write_Dgus(0x2000 + i * 0x10 + 2, eatFeedList[lookEatCnt][i] / 10 % 10);
Write_Dgus(0x2000 + i * 0x10 + 4, eatFeedList[lookEatCnt][i] / 100 % 10);
Write_Dgus(0x2000 + i * 0x10 + 6, eatFeedList[lookEatCnt][i] / 1000 % 10);
}
atu
{
Write_Dgus(0x2000 + i * 0x10 + 0, eatFeedList[lookEatCnt][i] % 10);
Write_Dgus(0x2000 + i * 0x10 + 2, eatFeedList[lookEatCnt][i] / 10 % 10);
}
}
}
}
//Tautuhi wharangi
atu mena(Va == 0x0302)
{
if(WaimaMode == 1)
{
TimeMode = 0;
Tuhia_Dgus(0x3A12, 139);
}
}
atu mena(Va == 0x0303)
{
if(WaimaMode == 0)
{
TimeMode = 1;
Tuhia_Dgus(0x3A12, 242);
}
}
atu mena(Va >= 0x0304 && Va
{
u16 whārangi whakawhiti[2] = {0x5A01, 19};
wharangi muri = 3;
backNum = Me;
setNum = timrIntervalHour[Va - 0x0304];
Tuhia_Dgus(0x4000 + 0, huingaNum % 10);
Tuhia_Dgus(0x4000 + 2, huingaNum / 10 % 10);
Tuhia_Dgus(0x4000 + 4, huingaNum / 100 % 10);
Tuhia_Dgus(0x4000 + 6, huingaNum / 1000 % 10);
write_dgus_vp(0x0084, whārangi whakawhiti, 2);
}
atu mena(Va >= 0x030A && Va
{
u16 whārangi whakawhiti[2] = {0x5A01, 19};
wharangi muri = 3;
backNum = Me;
setNum = Wā o nāianei[Va - 0x030A];
Tuhia_Dgus(0x4000 + 0, huingaNum % 10);
Tuhia_Dgus(0x4000 + 2, huingaNum / 10 % 10);
Tuhia_Dgus(0x4000 + 4, huingaNum / 100 % 10);
Tuhia_Dgus(0x4000 + 6, huingaNum / 1000 % 10);
write_dgus_vp(0x0084, whārangi whakawhiti, 2);
}
//Awhakatika whārangi raraunga
atu mena(Va == 0x0400) //Whakaū
{
u16 whārangi whakawhiti[2] = {0x5A01, 0x0000};
wharangi whakawhiti[1] = wharangi muri;
if(Whārangi muri == 1) //Hoki ki te whārangi tūnga
{
placeGramNum = huingaNum;
Tuhia_Dgus(0x1140 + 0, placeGramNum % 10);
Tuhia_Dgus(0x1140 + 2, placeGramNum / 10 % 10);
}
atu mena(Wharangi muri == 3)
{
if(backNuum >= 0x0304 && backNuum
{
u16 tīpako = 0;
tīpako = (backNum - 0x0304) * 0x10;
timrIntervalHour[backNum - 0x0304] = setNum;
Write_Dgus(0x3010 + tīpako + 0, setNum % 10);
Write_Dgus(0x3010 + tīpako + 2, setNum / 10 % 10);
}
atu mena(backNuum >= 0x030A && backNuum
{
u16 tīpako = 0;
tīpako = (backNum - 0x0304) * 0x10;
Wā o nāianei[backNum - 0x030A] = setNum;
if(backNuum == 0x030A)
{
Write_Dgus(0x3010 + tīpako + 0, setNum % 10);
Write_Dgus(0x3010 + tīpako + 2, setNum / 10 % 10);
Write_Dgus(0x3010 + tīpako + 4, setNum / 100 % 10);
Write_Dgus(0x3010 + tīpako + 6, setNum / 1000 % 10);
}
atu
{
Write_Dgus(0x3010 + tīpako + 0, setNum % 10);
Write_Dgus(0x3010 + tīpako + 2, setNum / 10 % 10);
}
}
}
write_dgus_vp(0x0084, whārangi whakawhiti, 2);
}
atu mena(Va == 0x0401) //Whakamuri
{
u16 whārangi whakawhiti[2] = {0x5A01, 0x0000};
wharangi whakawhiti[1] = wharangi muri;
write_dgus_vp(0x0084, whārangi whakawhiti, 2);
}
atu ki te(Va == 0x0402) //Te piki tau
{
huingaNum++;
Tuhia_Dgus(0x4000 + 0, huingaNum % 10);
Tuhia_Dgus(0x4000 + 2, huingaNum / 10 % 10);
Tuhia_Dgus(0x4000 + 4, huingaNum / 100 % 10);
Tuhia_Dgus(0x4000 + 6, huingaNum / 1000 % 10);
}
atu ki te(Va == 0x0403) //Paheketanga tau
{
mena(tautuhiNama > 0)
huingaNum--;
Tuhia_Dgus(0x4000 + 0, huingaNum % 10);
Tuhia_Dgus(0x4000 + 2, huingaNum / 10 % 10);
Tuhia_Dgus(0x4000 + 4, huingaNum / 100 % 10);
Tuhia_Dgus(0x4000 + 6, huingaNum / 1000 % 10);
}
Tuhia_Dgus(0x1000, 0);
}
}
Te wa tuku: Sep-19-2023