——Bho Fòram Luchd-leasachaidh DWIN
Anns an iris seo, bidh sinn a ’putadh a’ chùis stòr fosgailte a choisinn duaisean de DWIN Developer Forum - Multi-function Weigher. Bidh an innleadair a’ gabhail ri scrion smart 4-òirleach COF, agus tron eadar-obrachadh dàta eadar modal T5L OS core agus HX711 agus seata mothachaidh cuideam 5kg, is urrainn do luchd-cleachdaidh gu furasta na gnìomhan taisbeanaidh cunntaidh leithid cuideam, prìs aonad, prìs iomlan, teàrr, msaa a thoirt gu buil. ., A bharrachd air gnìomhan cunntais, tracadh lùban atharrachadh cuideam, agus ceartachadh cruinneas cuideam, msaa, gus am bi e furasta gluasad eadar diofar shuidheachaidhean tagraidh gus eòlas cuideam goireasach is èifeachdach a mhealtainn.
1. Leasachadh UI
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 Dealbhadh
Tha pàirt den chòd iomraidh airson an neach-tomhais a’ ghnìomh prìsean a chuir an gnìomh mar a leanas:
// Duilleag phrìsean================
#define VALUATION_UNIT_PRICE_ADDR 0x1010
#define VALUATION_GRAM_ADDR 0x1000
#define VALUATION_TOTAL_PRICES_ADDR 0x1020
uint32_t luachadh_decorticate = 0; // A 'prìsadh Cuideam Tare
uint32_t luachadh_unit_price = 0; // Prìs an Aonaid
// Ùrachadh Prìs Aonad
duilleag falamh_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
ma tha (valuation_unit_price
{
test_display[0] = luachadh_unit_price / 100 % 10 + 0x30;
test_display[1] = '.';
test_display[2] = luachadh_unit_price / 10 % 10 + 0x30;
test_display[3] = luachadh_unit_price / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
eile ma tha (valuation_unit_price
{
test_display[0] = luachadh_unit_price / 1000 % 10 + 0x30;
test_display[1] = luachadh_unit_price / 100 % 10 + 0x30;
test_display[2] = '.';
test_display[3] = luachadh_unit_price / 10 % 10 + 0x30;
test_display[4] = luachadh_unit_price / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
eile ma tha (valuation_unit_price
{
test_display[0] = luachadh_unit_price / 10000 % 10 + 0x30;
test_display[1] = luachadh_unit_price / 1000 % 10 + 0x30;
test_display[2] = luachadh_unit_price / 100 % 10 + 0x30;
test_display[3] = '.';
test_display[4] = luachadh_unit_price / 10 % 10 + 0x30;
test_display[5] = luachadh_unit_price / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
eile ma tha (valuation_unit_price
{
test_display[0] = luachadh_unit_price / 100000 % 10 + 0x30;
test_display[1] = luachadh_unit_price / 10000 % 10 + 0x30;
test_display[2] = luachadh_unit_price / 1000 % 10 + 0x30;
test_display[3] = luachadh_unit_price / 100 % 10 + 0x30;
test_display[4] = '.';
test_display[5] = luachadh_unit_price / 10 % 10 + 0x30;
test_display[6] = luachadh_unit_price / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
}
// Ùrachadh Cuideam
duilleag falamh_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
ma tha (gram_value> = luachadh_decorticate)
{
gram_display = gram_value - luachadh_decorticate;
ma tha (gram_display
{
test_display[0] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
eile ma tha (gram_display
{
test_display[0] = gram_display / 10 % 10 + 0x30;
test_display[1] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
eile ma tha (gram_display
{
test_display[0] = gram_display / 100 % 10 + 0x30;
test_display[1] = gram_display / 10 % 10 + 0x30;
test_display[2] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
eile ma tha (gram_display
{
test_display[0] = gram_display / 1000 % 10 + 0x30;
test_display[1] = gram_display / 100 % 10 + 0x30;
test_display[2] = gram_display / 10 % 10 + 0x30;
test_display[3] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
eile ma tha (gram_display
{
test_display[0] = gram_display / 10000 % 10 + 0x30;
test_display[1] = gram_display / 1000 % 10 + 0x30;
test_display[2] = gram_display / 100 % 10 + 0x30;
test_display[3] = gram_display / 10 % 10 + 0x30;
test_display[4] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
eile
{
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
// Ùrachadh Prìs Iomlan
duilleag falamh_valuation_price_refresh()
{
uint32_t price_value = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
ma tha (gram_value> = luachadh_decorticate)
{
price_value = (gram_value - luachadh_decorticate) * luachadh_unit_price * 2 / 1000;
ma tha (prìs_luach
{
test_display[0] = prìs_luach / 100 % 10 + 0x30;
test_display[1] = '.';
test_display[2] = prìs_luach / 10 % 10 + 0x30;
test_display[3] = prìs_luach / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
eile ma tha (prìs_luach
{
test_display[0] = prìs_luach / 1000 % 10 + 0x30;
test_display[1] = prìs_luach / 100 % 10 + 0x30;
test_display[2] = '.';
test_display[3] = prìs_luach / 10 % 10 + 0x30;
test_display[4] = prìs_luach / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
eile ma tha (prìs_luach
{
test_display[0] = prìs_luach / 10000 % 10 + 0x30;
test_display[1] = prìs_luach / 1000 % 10 + 0x30;
test_display[2] = prìs_luach / 100 % 10 + 0x30;
test_display[3] = '.';
test_display[4] = prìs_luach / 10 % 10 + 0x30;
test_display[5] = prìs_luach / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
eile ma tha (prìs_luach
{
test_display[0] = prìs_luach / 100000 % 10 + 0x30;
test_display[1] = prìs_luach / 10000 % 10 + 0x30;
test_display[2] = prìs_luach / 1000 % 10 + 0x30;
test_display[3] = prìs_luach / 100 % 10 + 0x30;
test_display[4] = '.';
test_display[5] = prìs_luach / 10 % 10 + 0x30;
test_display[6] = prìs_luach / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
eile
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
duilleag falamh_valuation_decorticate()
{
luachadh_decorticate = gram_value;
page_valuation_weight_refresh();
}
duilleag falamh_luachadh_1()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 1;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_valuation_2()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 2;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_luachadh_3()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 3;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_luachadh_4()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 4;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_valuation_5()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 5;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_luachadh_6()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 6;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_valuation_7()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 7;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_luachadh_8()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 8;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_luachadh_9()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 9;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_valuation_0()
{
ma tha (valuation_unit_price
{
luachadh_unit_price = luachadh_unit_price * 10 + 0;
page_valuation_unit_price_refresh();
}
}
duilleag falamh_valuation_back()
{
luachadh_unit_price = luachadh_unit_price / 10;
page_valuation_unit_price_refresh();
}
duilleag falamh_valuation_soilleir()
{
luachadh_unit_price = 0;
page_valuation_unit_price_refresh();
}
Ùine puist: Giblean-28-2024