——Ho tsoa ho Foramo ea Baetsi ba DWIN
Khatisong ena, re sutumelletsa nyeoe ea mohloli o bulehileng o hapileng likhau oa DWIN Developer Forum - Multi-function Weigher. Moenjiniere o amohela skrine e bohlale ea 4-inch COF, 'me ka tšebelisano ea data pakeng tsa T5L OS core le HX711 module le 5kg pressure sensor set, basebelisi ba ka lemoha habonolo mesebetsi ea ho bala e kang boima, theko ea yuniti, theko eohle, tare, joalo-joalo. ., hammoho le mesebetsi ea ho bala, ho lata li-curve tsa ho fetola boima ba 'mele, le ho lokisa ho nepahala ha boima, joalo-joalo, e le hore ho be bonolo ho fetola lipakeng tsa maemo a fapaneng a ts'ebeliso ho thabela boiphihlelo bo bonolo le bo sebetsang ba ho bekha.
1. Ntlafatso ea UI
2.C51 Moralo
Karolo ea litšupiso tsa khoutu ea sekala ho kenya tšebetsong tšebetso ea litheko ke e latelang:
// Leqephe la Ditheko=====================
#define VALUE_UNIT_PRICE_ADDR 0x1010
#define VALUE_GRAM_ADDR 0x1000
#define VALUE_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // Theko ya Boima ba Tare
uint32_t valuation_unit_price = 0; //Theko ea thepa ka 'ngoe
// Ho nchafatsa Theko ea Yuniti
leqephe le se nang letho_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
haeba(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);
}
ho seng joalo haeba(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);
}
ho seng joalo haeba(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);
}
ho seng joalo haeba(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);
}
}
// Ho hlabolla boima ba mmele
leqephe le se nang letho_valuation_weight_refresh()
{
uint8_t test_display[10] = {0x30};
uint32_t gram_display = 0;
haeba(gram_value>= valuation_decorticate)
{
gram_display = gram_value - valuation_decorticate;
haeba(gram_display
{
test_display[0] = gram_display / 1 % 10 + 0x30;
dgus_show_text_value_set(VALUE_GRAM_ADDR, test_display, 3);
}
ho seng joalo (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);
}
ho seng joalo (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);
}
ho seng joalo (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);
}
ho seng joalo (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);
}
}
tse ling
{
dgus_show_text_value_set(VALUE_GRAM_ADDR, test_display, 3);
}
}
// Kakaretso ea Tsosoloso ea Theko
leqephe le se nang letho_valuation_price_refresh()
{
uint32_t price_value = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
haeba(gram_value>= valuation_decorticate)
{
price_value = (gram_value - valuation_decorticate) * valuation_unit_price * 2 / 1000;
haeba(theko_boleng
{
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);
}
ho seng joalo haeba(price_value
{
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);
}
ho seng joalo haeba(price_value
{
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);
}
ho seng joalo haeba(price_value
{
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);
}
}
tse ling
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
leqephe le se nang letho_valuation_decorticate()
{
valuation_decorticate = gram_value;
page_valuation_weight_refresh();
}
leqephe le se nang letho_valuation_1()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 1;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_2()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 2;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_3()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 3;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_4()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 4;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_5()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 5;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_6()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 6;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_7()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 7;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_8()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 8;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_9()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 9;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_0()
{
haeba(valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 0;
page_valuation_unit_price_refresh();
}
}
leqephe le se nang letho_valuation_back()
{
valuation_unit_price = valuation_unit_price / 10;
page_valuation_unit_price_refresh();
}
leqephe le se nang letho_valuation_clear()
{
valuation_unit_price = 0;
page_valuation_unit_price_refresh();
}
Nako ea poso: Apr-28-2024