——Frá DWIN Developer Forum
Í þessu hefti ýtum við á hið margverðlaunaða opna tilfelli DWIN Developer Forum - Multi-function Weigher. Verkfræðingurinn notar 4 tommu COF snjallskjá og í gegnum gagnasamskiptin milli T5L OS kjarna og HX711 einingarinnar og 5 kg þrýstiskynjara setts, geta notendur auðveldlega áttað sig á talningarskjánum eins og þyngd, einingarverð, heildarverð, tara osfrv. ., sem og aðgerðir talningar, rakningar á þyngdarbreytingarferlum og leiðréttingar á nákvæmni vigtar o.s.frv., þannig að auðvelt sé að skipta á milli mismunandi notkunarsviðsmynda til að njóta þægilegrar og skilvirkrar vigtunarupplifunar.
1. Þróun HÍ
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 Hönnun
Hluti af tilvísunarkóða fyrir vigtarmann til að innleiða verðlagningaraðgerðina er sem hér segir:
// Verðsíða====================
#define VALUATION_UNIT_PRICE_ADDR 0x1010
#define VALUATION_GRAM_ADDR 0x1000
#skilgreina VALUATION_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // Verðlagning Eiginleikaþyngd
uint32_t valuation_unit_price = 0; //Einingaverð
// Einingaverð Refresh
ógilt page_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
if(virðiseiningar_verð
{
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);
}
annað ef (verðmatseiningar_verð
{
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);
}
annað ef (verðmatseiningar_verð
{
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);
}
annað ef (verðmatseiningar_verð
{
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] = verðmatseiningarverð / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);
}
}
// Þyngd Refresh
ógilt page_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
if(gram_value >= valuation_decorticate)
{
gram_display = gram_value - valuation_decorticate;
if(gram_display
{
test_display[0] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
annað ef (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);
}
annað ef (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);
}
annað ef (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);
}
annað ef (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);
}
}
Annar
{
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
// Heildarverð endurnýjun
ógilt page_valuation_price_refresh()
{
uint32_t verð_gildi = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
if(gram_value >= valuation_decorticate)
{
verð_verð = (gramm_gildi - verðmat_skreytt) * verðmatseiningar_verð * 2 / 1000;
if(verð_gildi
{
test_display[0] = verð_gildi / 100 % 10 + 0x30;
test_display[1] = '.';
test_display[2] = verð_verðmæti / 10 % 10 + 0x30;
test_display[3] = verð_gildi / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
annað ef (verð_gildi
{
test_display[0] = verð_gildi / 1000 % 10 + 0x30;
test_display[1] = verð_verðmæti / 100 % 10 + 0x30;
test_display[2] = '.';
test_display[3] = verð_verðmæti / 10 % 10 + 0x30;
test_display[4] = verð_gildi / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
annað ef (verð_gildi
{
test_display[0] = verð_gildi / 10000 % 10 + 0x30;
test_display[1] = verð_verðmæti / 1000 % 10 + 0x30;
test_display[2] = verð_gildi / 100 % 10 + 0x30;
test_display[3] = '.';
test_display[4] = verð_verðmæti / 10 % 10 + 0x30;
test_display[5] = verð_gildi / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
annað ef (verð_gildi
{
test_display[0] = verð_gildi / 100.000 % 10 + 0x30;
test_display[1] = verð_verðmæti / 10000 % 10 + 0x30;
test_display[2] = verð_verðmæti / 1000 % 10 + 0x30;
test_display[3] = verð_verðmæti / 100 % 10 + 0x30;
test_display[4] = '.';
test_display[5] = verð_verðmæti / 10 % 10 + 0x30;
test_display[6] = verð_gildi / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
Annar
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
ógilt page_valuation_decorticate()
{
valuation_decorticate = gram_gildi;
page_valuation_weight_refresh();
}
ógild síða_virði_1()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 1;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_2()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 2;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_3()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 3;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_4()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 4;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_5()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 5;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_6()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 6;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_7()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 7;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_8()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 8;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_9()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 9;
page_valuation_unit_price_refresh();
}
}
ógild síða_virði_0()
{
if(virðiseiningarverð
{
verðmatseiningarverð = verðmatseiningarverð * 10 + 0;
page_valuation_unit_price_refresh();
}
}
ógild síða_mat_til baka()
{
verðmatseiningarverð = verðmatseiningarverð / 10;
page_valuation_unit_price_refresh();
}
ógilt page_valuation_clear()
{
verðmatseiningarverð = 0;
page_valuation_unit_price_refresh();
}
Pósttími: 28. apríl 2024