——Mill-Forum tal-Iżviluppaturi DWIN
F'din il-ħarġa, aħna nimbottaw il-każ open-source rebbieħ tal-għotja ta 'DWIN Developer Forum - Multi-function Weigher. L-inġinier jadotta skrin intelliġenti COF ta '4 pulzieri, u permezz tal-interazzjoni tad-dejta bejn il-qalba T5L OS u l-modulu HX711 u s-sett tas-sensor tal-pressjoni ta' 5kg, l-utenti jistgħu faċilment jirrealizzaw il-funzjonijiet tal-wiri tal-għadd bħall-piż, il-prezz tal-unità, il-prezz totali, it-tara, eċċ ., kif ukoll il-funzjonijiet tal-għadd, it-traċċar tal-kurvi tal-bidla fil-piż, u l-korrezzjoni tal-eżattezza tal-użin, eċċ., sabiex ikun faċli li taqleb bejn xenarji ta 'applikazzjoni differenti biex tgawdi esperjenza ta' użin konvenjenti u effiċjenti.
1. Żvilupp tal-UI
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 Disinn
Parti mill-kodiċi ta' referenza għall-użin biex jimplimenta l-funzjoni tal-ipprezzar hija kif ġej:
// Paġna tal-Ipprezzar====================
#define VALUATION_UNIT_PRICE_ADDR 0x1010
#define VALUATION_GRAM_ADDR 0x1000
#define VALUATION_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // Ipprezzar Tare Weight
uint32_t valuation_unit_price = 0; //Prezz Unit
// Aġġorna l-Prezz ta' Unità
void page_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
if(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);
}
inkella jekk(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);
}
inkella jekk (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);
}
inkella jekk (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);
}
}
// Aġġorna l-Piż
void page_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
if(valur_gramma >= valutazzjoni_decorticate)
{
gram_display = gram_value - valutazzjoni_decorticate;
if(gram_display
{
test_display[0] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
inkella jekk (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);
}
inkella jekk (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);
}
inkella jekk (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);
}
inkella jekk (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);
}
}
inkella
{
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
// Aġġornament tal-Prezz Totali
void page_valuation_price_refresh()
{
uint32_t price_value = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
if(valur_gramma >= valutazzjoni_dekortikata)
{
price_value = (valur_gramma - valutazzjoni_decorticate) * valuation_unit_price * 2 / 1000;
jekk(valur_prezz
{
test_display[0] = price_value / 100 % 10 + 0x30;
test_display[1] = '.';
test_display[2] = price_value / 10 % 10 + 0x30;
test_display[3] = price_value / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
inkella jekk (prezz_valur
{
test_display[0] = price_value / 1000 % 10 + 0x30;
test_display[1] = price_value / 100 % 10 + 0x30;
test_display[2] = '.';
test_display[3] = price_value / 10 % 10 + 0x30;
test_display[4] = price_value / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
inkella jekk (valur_prezz
{
test_display[0] = price_value / 10000 % 10 + 0x30;
test_display[1] = price_value / 1000 % 10 + 0x30;
test_display[2] = price_value / 100 % 10 + 0x30;
test_display[3] = '.';
test_display[4] = price_value / 10 % 10 + 0x30;
test_display[5] = price_value / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
inkella jekk (prezz_valur
{
test_display[0] = price_value / 100000 % 10 + 0x30;
test_display[1] = price_value / 10000 % 10 + 0x30;
test_display[2] = price_value / 1000 % 10 + 0x30;
test_display[3] = price_value / 100 % 10 + 0x30;
test_display[4] = '.';
test_display[5] = price_value / 10 % 10 + 0x30;
test_display[6] = price_value / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
inkella
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
void page_valuation_decorticate()
{
valuation_decorticate = valur_gramma;
page_valuation_weight_refresh ();
}
void page_valuation_1()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 1;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_2()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 2;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_3()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 3;
page_valuation_unit_price_refresh ();
}
}
null page_valuation_4()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 4;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_5()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 5;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_6()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 6;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_7()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 7;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_8()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 8;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_9()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 9;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_0()
{
if(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 0;
page_valuation_unit_price_refresh ();
}
}
void page_valuation_back ()
{
valuation_unit_price = valuation_unit_price / 10;
page_valuation_unit_price_refresh ();
}
void page_valuation_clear()
{
valuation_unit_price = 0;
page_valuation_unit_price_refresh ();
}
Ħin tal-post: Apr-28-2024