——Na DWIN Developer Forum
I roto i tenei putanga, ka panaia e matou te keehi puna-tuwhera tohu-toa a DWIN Developer Forum - Multi-function Weigher. Ka tango te miihini i te mata atamai COF 4-inihi, a na roto i te taunekeneke raraunga i waenga i te T5L OS matua me te waahanga HX711 me te huinga puoro 5kg, ka taea e nga kaiwhakamahi te mohio ki nga mahi whakaatu tatau penei i te taumaha, te utu wae, te utu katoa, tare, aha atu. ., me nga mahi o te tatau, te aroturuki i nga pihi huringa taumaha, me te whakatika i te tika o te pauna, me etahi atu, kia ngawari ai te huri i waenga i nga ahuatanga tono rereke kia pai ai te wheako taumaha me te pai.
1. Whanaketanga UI
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 Hoahoa
Ko tetahi waahanga o te tohu tohutoro mo te kai pauna hei whakatinana i te mahi utu e whai ake nei:
// Utu Whārangi ====================
#define VALUATION_UNIT_PRICE_ADDR 0x1010
#tautuhia te VALUATION_GRAM_ADDR 0x1000
#tautuhia te VALUATION_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // Utu Taumaha Tare
uint32_t valuation_unit_price = 0; //Utu Wae
// Unit Price Tāmata
karekau page_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
ki te(utu_waatea_utu
{
whakakitenga_whakamatautau[0] = utu_wae_whakatau / 100 % 10 + 0x30;
whakakitenga_whakamatautau[1] = '.';
whakakitenga_whakamatautau[2] = utu_wae_whakatau / 10 % 10 + 0x30;
whakakitenga_whakamatautau[3] = utu_wae_whakatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
ki te mea(utu_waatea_utu
{
whakakitenga_whakamatautau[0] = utu_wae_whakaaro / 1000 % 10 + 0x30;
whakakitenga_whakamatautau[1] = utu_wae_whakatau / 100 % 10 + 0x30;
whakaatu_whakamatautau[2] = '.';
whakakitenga_whakamatautau[3] = utu_wae_whakatau / 10 % 10 + 0x30;
whakakitenga_whakamatautau[4] = utu_wae_whakatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
ki te mea(utu_waatea_utu
{
whakakitenga_whakamatautau[0] = utu_wae_whakatau / 10000 % 10 + 0x30;
whakakitenga_whakamatautau[1] = utu_wae_whakaaro / 1000 % 10 + 0x30;
whakakitenga_whakamatautau[2] = utu_wae_whakatau / 100 % 10 + 0x30;
whakakitenga_whakamatautau[3] = '.';
whakakitenga_whakamatautau[4] = utu_wae_whakamarie / 10 % 10 + 0x30;
whakakitenga_whakamatautau[5] = utu_wae_whakatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
ki te mea(utu_waatea_utu
{
whakakitenga_whakamatautau[0] = utu_wae_whakatau / 100000 % 10 + 0x30;
whakakitenga_whakamatautau[1] = utu_wae_whakatau / 10000 % 10 + 0x30;
whakakitenga_whakamatautau[2] = utu_wae_whakatau / 1000 % 10 + 0x30;
whakakitenga_whakamatautau[3] = utu_wae_whakatau / 100 % 10 + 0x30;
whakakitenga_whakamatautau[4] = '.';
whakakitenga_whakamatautau[5] = utu_wae_whakatau / 10 % 10 + 0x30;
whakakitenga_whakamatautau[6] = utu_wae_whakatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
}
// Taumaha Tāmata
karekau page_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
mena(te uara_karamu >= valuation_decorticate)
{
gram_display = uara_karamu - valuation_decorticate;
ki te(gram_whakaatu
{
whakaatu_whakamatautau[0] = karamu_whakaatu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
atu mena(gram_display
{
whakaatu_whakamatautau[0] = karamu_whakaatu / 10 % 10 + 0x30;
whakaatu_whakamatautau[1] = karamu_whakaatu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
atu mena(gram_display
{
whakakitenga_whakamatautau[0] = karamu_whakaatu / 100 % 10 + 0x30;
whakaatu_whakamatautau[1] = karamu_whakaatu / 10 % 10 + 0x30;
whakaatu_whakamatautau[2] = karamu_whakaatu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
atu mena(gram_whakaatu
{
whakaatu_whakamatautau[0] = karamu_whakaatu / 1000 % 10 + 0x30;
whakaatu_whakamatautau[1] = karamu_whakaatu / 100 % 10 + 0x30;
whakaatu_whakamatautau[2] = karamu_whakaatu / 10 % 10 + 0x30;
whakaatu_whakamatautau[3] = karamu_whakaatu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
atu mena(gram_whakaatu
{
whakakitenga_whakamatautau[0] = karamu_whakaatu / 10000 % 10 + 0x30;
whakaatu_whakamatautau[1] = karamu_whakaatu / 1000 % 10 + 0x30;
whakaatu_whakamatautau[2] = karamu_whakaatu / 100 % 10 + 0x30;
whakaatu_whakamatautau[3] = karamu_whakaatu / 10 % 10 + 0x30;
whakaatu_whakamatautau[4] = karamu_whakaatu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
atu
{
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
// Tapeke Utu Tāmata
karekau page_valuation_price_refresh()
{
uint32_t price_value = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
mena(te uara_karamu >= valuation_decorticate)
{
utu_uara = (karamu - valuation_decorticate) * valuation_unit_price * 2 / 1000;
mena(uara_utu
{
whakakitenga_whakamatautau[0] = uara_utu / 100 % 10 + 0x30;
whakakitenga_whakamatautau[1] = '.';
whakakitenga_whakamatautau[2] = uara_utu / 10 % 10 + 0x30;
whakakitenga_whakamatautau[3] = uara_utu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
atu mena(uara_utu
{
whakakitenga_whakamatautau[0] = uara_utu / 1000 % 10 + 0x30;
whakakitenga_whakamatautau[1] = uara_utu / 100 % 10 + 0x30;
whakaatu_whakamatautau[2] = '.';
whakakitenga_whakamatautau[3] = uara_utu / 10 % 10 + 0x30;
whakakitenga_whakamatautau[4] = uara_utu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
atu mena(uara_utu
{
whakakitenga_whakamatautau[0] = uara_utu / 10000 % 10 + 0x30;
whakakitenga_whakamatautau[1] = uara_utu / 1000 % 10 + 0x30;
whakakitenga_whakamatautau[2] = uara_utu / 100 % 10 + 0x30;
whakakitenga_whakamatautau[3] = '.';
whakakitenga_whakamatautau[4] = uara_utu / 10 % 10 + 0x30;
whakakitenga_whakamatautau[5] = uara_utu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
atu ki te(uara_utu
{
whakaatu_whakamatautau[0] = uara_utu / 100000 % 10 + 0x30;
whakakitenga_whakamatautau[1] = uara_utu / 10000 % 10 + 0x30;
whakaatu_whakamatautau[2] = uara_utu / 1000 % 10 + 0x30;
whakakitenga_whakamatautau[3] = uara_utu / 100 % 10 + 0x30;
whakakitenga_whakamatautau[4] = '.';
whakakitenga_whakamatautau[5] = uara_utu / 10 % 10 + 0x30;
whakaatu_whakamatautau[6] = uara_utu / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
atu
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
karekau page_valuation_decorticate()
{
valuation_decorticate = uara_karamu;
page_valuation_weight_refresh();
}
karekau page_valuation_1()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 1;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_2()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 2;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_3()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 3;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_4()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 4;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_5()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 5;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_6()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 6;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_7()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 7;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_8()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 8;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_9()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 9;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_0()
{
mena(utu_waatea_utu
{
valuation_unit_price = valuation_unit_price * 10 + 0;
page_valuation_unit_price_refresh();
}
}
karekau page_valuation_back()
{
valuation_unit_price = valuation_unit_price / 10;
page_valuation_unit_price_refresh();
}
karekau page_valuation_clear()
{
utu_wae_whakaaro = 0;
page_valuation_unit_price_refresh();
}
Te wa tuku: Apr-28-2024