——Mai le DWIN Developer Forum
I lenei lomiga, matou te tuleia le faʻailoga-manumalo tatala-puna mataupu o le DWIN Developer Forum - Multi-function Weigher. E faʻaaogaina e le inisinia se 4-inisi COF mata atamai, ma e ala i fesoʻotaʻiga faʻamatalaga i le va o le T5L OS autu ma le HX711 module ma le 5kg pressure sensor seti, e mafai e tagata faʻaoga ona faigofie ona iloa galuega faʻaalia e pei o le mamafa, tau iunite, tau atoa, titania, ma isi. ., faʻapea foʻi ma galuega o le faitau, suʻesuʻeina o suiga o le mamafa, ma le faʻasaʻoina o le saʻo o le mamafa, ma isi, ina ia faigofie ai ona fesuiaʻi i le va o faʻataʻitaʻiga faʻaoga eseese e fiafia ai i se poto masani ma lelei.
1. Atina'e UI
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 Fuafuaga
O se vaega o le fa'ailoga fa'asino mo le fua fa'atatau e fa'atino ai le tau fa'atatau e fa'apea:
// Tau Itulau ====================
#fa'amatala VALUATION_UNIT_PRICE_ADDR 0x1010
#define VALUATION_GRAM_ADDR 0x1000
#fa'amatala VALUATION_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // Tau le mamafa o le tara
uint32_t valuation_unit_price = 0; //Iunite Tau
// Toefuataiga Tau Iuni
fa'aleaogaina itulau_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
pe afai(valuation_unit_price
{
fa'aaliga_su'ega[0] = tau_iunite fa'atatau / 100 % 10 + 0x30;
test_display[1] = '.';
fa'aaliga_fa'ata'ita'i[2] = tau_iunite fa'atatau / 10 % 10 + 0x30;
fa'aaliga_su'ega[3] = tau_iunite fa'atatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
isi pe afai(valuation_unit_price
{
fa'aali_su'ega[0] = tau_iunite fa'atatau / 1000 % 10 + 0x30;
fa'aaliga_su'ega[1] = tau_iunite fa'atatau / 100 % 10 + 0x30;
test_display[2] = '.';
fa'aali_su'ega[3] = tau_iunite fa'atatau / 10 % 10 + 0x30;
fa'aali_su'ega[4] = tau_iunite fa'atatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
isi pe afai(valuation_unit_price
{
fa'aaliga_su'ega[0] = tau_iunite fa'atatau / 10000 % 10 + 0x30;
fa'aali_su'ega[1] = tau_iunite fa'atatau / 1000 % 10 + 0x30;
fa'aaliga_su'ega[2] = tau_iunite fa'atatau / 100 % 10 + 0x30;
test_display[3] = '.';
fa'aaliga_su'ega[4] = tau_iunite fa'atatau / 10 % 10 + 0x30;
fa'aaliga_su'ega[5] = tau_iunite fa'atatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
isi pe afai(valuation_unit_price
{
fa'aali_su'ega[0] = tau_unit_fuafua / 100000 % 10 + 0x30;
fa'aaliga_su'ega[1] = tau_iunite fa'atatau / 10000 % 10 + 0x30;
fa'aaliga_su'ega[2] = tau_iunite fa'atatau / 1000 % 10 + 0x30;
fa'aali_su'ega[3] = tau_iunite fa'atatau / 100 % 10 + 0x30;
test_display[4] = '.';
fa'aaliga_su'ega[5] = tau_iunite fa'atatau / 10 % 10 + 0x30;
fa'aaliga_su'ega[6] = tau_iunite fa'atatau / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
}
// Fa'afouina o le mamafa
fa'aleaogaina itulau_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
afai(gram_value >= valuation_decorticate)
{
gram_display = gram_value - valuation_decorticate;
afai(gram_fa'aaliga
{
su'ega_fa'aali[0] = gram_fa'aaliga / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
isi pe afai(gram_display
{
su'ega_fa'aali[0] = gram_fa'aaliga / 10 % 10 + 0x30;
su'ega_fa'aali[1] = gram_fa'aaliga / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
isi pe afai(gram_display
{
su'ega_fa'aali[0] = gram_fa'aaliga / 100 % 10 + 0x30;
su'ega_fa'aali[1] = gram_fa'aaliga / 10 % 10 + 0x30;
su'ega_fa'aali[2] = gram_fa'aaliga / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
isi pe afai(gram_display
{
su'ega_fa'aali[0] = gram_fa'aaliga / 1000 % 10 + 0x30;
su'ega_fa'aali[1] = gram_fa'aaliga / 100 % 10 + 0x30;
su'ega_fa'aali[2] = gram_fa'aaliga / 10 % 10 + 0x30;
su'ega_fa'aali[3] = gram_fa'aaliga / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
isi pe afai(gram_display
{
su'ega_fa'aaliga[0] = gram_fa'aaliga / 10000 % 10 + 0x30;
su'ega_fa'aaliga[1] = gram_fa'aaliga / 1000 % 10 + 0x30;
su'ega_fa'aaliga[2] = gram_fa'aaliga / 100 % 10 + 0x30;
su'ega_fa'aali[3] = gram_fa'aaliga / 10 % 10 + 0x30;
su'ega_fa'aali[4] = gram_fa'aaliga / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
isi
{
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
// Aofa'iga Tau Toe Fa'afouina
fa'aleaogaina itulau_valuation_price_refresh()
{
uint32_t tau_taua = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
afai(gram_value >= valuation_decorticate)
{
tau_taua = (gram_value - valuation_decorticate) * valuation_unit_price * 2 / 1000;
afai(tau_taua
{
su'ega_fa'aaliga[0] = tau_taua / 100 % 10 + 0x30;
test_display[1] = '.';
su'ega_fa'aaliga[2] = tau_taua / 10 % 10 + 0x30;
su'ega_fa'aaliga[3] = tau_taua / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
isi pe afai(tau_taua
{
su'ega_fa'aaliga[0] = tau_taua / 1000 % 10 + 0x30;
su'ega_fa'aaliga[1] = tau_taua / 100 % 10 + 0x30;
test_display[2] = '.';
su'ega_fa'aaliga[3] = tau_taua / 10 % 10 + 0x30;
su'ega_fa'aaliga[4] = tau_taua / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
isi pe afai(tau_taua
{
su'ega_fa'aaliga[0] = tau_taua / 10000 % 10 + 0x30;
su'ega_fa'aaliga[1] = tau_taua / 1000 % 10 + 0x30;
su'ega_fa'aaliga[2] = tau_taua / 100 % 10 + 0x30;
test_display[3] = '.';
su'ega_fa'aali[4] = tau_taua / 10 % 10 + 0x30;
su'ega_fa'aaliga[5] = tau_taua / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
isi pe afai(tau_taua
{
su'ega_fa'aaliga[0] = tau_taua / 100000 % 10 + 0x30;
su'ega_fa'aaliga[1] = tau_taua / 10000 % 10 + 0x30;
su'ega_fa'aaliga[2] = tau_taua / 1000 % 10 + 0x30;
su'ega_fa'aaliga[3] = tau_taua / 100 % 10 + 0x30;
test_display[4] = '.';
su'ega_fa'aaliga[5] = tau_taua / 10 % 10 + 0x30;
su'ega_fa'aaliga[6] = tau_taua / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
isi
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
fa'aleaogaina itulau_valuation_decorticate()
{
valuation_decorticate = gram_value;
page_valuation_weight_refresh();
}
fa'aleaogaina itulau_valuation_1()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 1;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_2()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 2;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_3()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 3;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_4()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 4;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_5()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 5;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_6()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 6;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_7()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 7;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_8()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 8;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_9()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 9;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_0()
{
pe afai(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 0;
itulau_valuation_unit_price_refresh();
}
}
fa'aleaogaina itulau_valuation_back()
{
valuation_unit_price = valuation_unit_price / 10;
itulau_valuation_unit_price_refresh();
}
fa'aleaogaina itulau_valuation_clear()
{
tau_iunite tau = 0;
itulau_valuation_unit_price_refresh();
}
Taimi meli: Apr-28-2024