——Kuchokera ku DWIN Developer Forum
Munkhaniyi, tikukankhira mlandu womwe wapambana mphoto wa DWIN Developer Forum - Multi-function Weigher. Wopangayo amatenga chophimba chanzeru cha 4-inchi COF, ndipo kudzera mu kulumikizana kwa data pakati pa gawo la T5L OS core ndi HX711 module ndi 5kg pressure sensor set, ogwiritsa ntchito amatha kuzindikira mosavuta ntchito zowerengera monga kulemera, mtengo wagawo, mtengo wonse, tare, ndi zina zambiri. ., komanso ntchito zowerengera, kutsata ma curve osintha kulemera, ndikuwongolera kulondola kwa sikelo, ndi zina zotero, kuti zikhale zosavuta kusinthana pakati pa zochitika zosiyanasiyana zogwiritsira ntchito kuti musangalale ndi zoyezera zosavuta komanso zogwira mtima.
1. Kukula kwa UI
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 Mapangidwe
Gawo lina lachidziwitso la woyezera kuti agwiritse ntchito mitengo yake ndi motere:
// Tsamba la Mitengo====================
#tanthauzira VALUE_UNIT_PRICE_ADDR 0x1010
#tanthauzirani VALUE_GRAM_ADDR 0x1000
# fotokozani VALUE_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // Mitengo Kulemera kwa Tare
uint32_t valuation_unit_price = 0; //Mtengo wagawo
// Kutsitsimutsa Mtengo Wagawo
tsamba lopanda_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
ngati(valuation_unit_price
{
test_display[0] = valuation_unit_price / 100% 10 + 0x30;
test_display[1] = '.';
test_display[2] = valuation_unit_price / 10% 10 + 0x30;
test_display[3] = valuation_unit_price / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
china ngati (valuation_unit_price
{
test_display[0] = valuation_unit_price / 1000% 10 + 0x30;
test_display[1] = valuation_unit_price / 100% 10 + 0x30;
test_display[2] = '.';
test_display[3] = valuation_unit_price / 10% 10 + 0x30;
test_display[4] = valuation_unit_price / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
zina ngati (valuation_unit_price
{
test_display[0] = valuation_unit_price / 10000 % 10 + 0x30;
test_display[1] = valuation_unit_price / 1000% 10 + 0x30;
test_display[2] = valuation_unit_price / 100% 10 + 0x30;
test_display[3] = '.';
test_display[4] = valuation_unit_price / 10% 10 + 0x30;
test_display[5] = valuation_unit_price / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
zina ngati (valuation_unit_price
{
test_display[0] = valuation_unit_price / 100000 % 10 + 0x30;
test_display[1] = valuation_unit_price / 10000 % 10 + 0x30;
test_display[2] = valuation_unit_price / 1000% 10 + 0x30;
test_display[3] = valuation_unit_price / 100% 10 + 0x30;
test_display[4] = '.';
test_display[5] = valuation_unit_price / 10% 10 + 0x30;
test_display[6] = valuation_unit_price / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
}
// Kutsitsimula Kulemera
tsamba lopanda kanthu_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
ngati(gram_value>= valuation_decorticate)
{
gram_display = gram_value - valuation_decorticate;
ngati (gram_display
{
test_display[0] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUE_GRAM_ADDR, test_display, 3);
}
ngati (gram_display
{
test_display[0] = gram_display / 10% 10 + 0x30;
test_display[1] = gram_display / 1% 10 + 0x30;
dgus_show_text_value_set(VALUE_GRAM_ADDR, test_display, 3);
}
ngati (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(VALUE_GRAM_ADDR, test_display, 3);
}
ngati (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(VALUE_GRAM_ADDR, test_display, 3);
}
ngati (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(VALUE_GRAM_ADDR, test_display, 3);
}
}
zina
{
dgus_show_text_value_set(VALUE_GRAM_ADDR, test_display, 3);
}
}
// Kutsitsimutsa Kwamtengo Wathunthu
tsamba lopanda kanthu_valuation_price_refresh()
{
uint32_t mtengo_value = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
ngati(gram_value>= valuation_decorticate)
{
mtengo_mtengo = (gram_value - valuation_decorticate) * valuation_unit_price * 2 / 1000;
ngati(mtengo_mtengo
{
test_display[0] = mtengo_mtengo / 100% 10 + 0x30;
test_display[1] = '.';
test_display[2] = mtengo_mtengo / 10% 10 + 0x30;
test_display[3] = mtengo_mtengo / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
ngati (price_value
{
test_display[0] = mtengo_mtengo / 1000% 10 + 0x30;
test_display[1] = mtengo_mtengo / 100% 10 + 0x30;
test_display[2] = '.';
test_display[3] = mtengo_mtengo / 10% 10 + 0x30;
test_display[4] = mtengo_mtengo / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
ngati (price_value
{
test_display[0] = mtengo_mtengo / 10000% 10 + 0x30;
test_display[1] = mtengo_mtengo / 1000% 10 + 0x30;
test_display[2] = mtengo_mtengo / 100% 10 + 0x30;
test_display[3] = '.';
test_display[4] = mtengo_mtengo / 10% 10 + 0x30;
test_display[5] = mtengo_mtengo / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
ngati (price_value
{
test_display[0] = mtengo_mtengo / 100000 % 10 + 0x30;
test_display[1] = mtengo_mtengo / 10000% 10 + 0x30;
test_display[2] = mtengo_mtengo / 1000% 10 + 0x30;
test_display[3] = mtengo_mtengo / 100% 10 + 0x30;
test_display[4] = '.';
test_display[5] = mtengo_mtengo / 10% 10 + 0x30;
test_display[6] = mtengo_mtengo / 1% 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
zina
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
tsamba lopanda kanthu_valuation_decorticate()
{
valuation_decorticate = gram_value;
page_valuation_weight_refresh();
}
tsamba lopanda kanthu_valuation_1()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 1;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda_valuation_2()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 2;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda kanthu_valuation_3()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 3;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda kanthu_valuation_4()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 4;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda_valuation_5()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 5;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda kanthu_valuation_6()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 6;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda kanthu_valuation_7()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 7;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda_valuation_8()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 8;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda_valuation_9()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 9;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda_kuwerengera_0()
{
ngati(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 0;
page_valuation_unit_price_refresh();
}
}
tsamba lopanda_valuation_back()
{
valuation_unit_price = valuation_unit_price / 10;
page_valuation_unit_price_refresh();
}
tsamba lopanda kanthu_valuation_clear()
{
valuation_unit_price = 0;
page_valuation_unit_price_refresh();
}
Nthawi yotumiza: Apr-28-2024