——DWIN ഡവലപ്പർ ഫോറത്തിൽ നിന്ന്
ഈ ലക്കത്തിൽ, DWIN ഡെവലപ്പർ ഫോറത്തിൻ്റെ അവാർഡ് നേടിയ ഓപ്പൺ സോഴ്സ് കേസ് ഞങ്ങൾ മുന്നോട്ട് വയ്ക്കുന്നു - മൾട്ടി-ഫംഗ്ഷൻ വെയ്സർ. എഞ്ചിനീയർ 4 ഇഞ്ച് COF സ്മാർട്ട് സ്ക്രീൻ സ്വീകരിക്കുന്നു, കൂടാതെ T5L OS കോർ, HX711 മൊഡ്യൂൾ, 5kg പ്രഷർ സെൻസർ സെറ്റ് എന്നിവയ്ക്കിടയിലുള്ള ഡാറ്റാ ഇൻ്ററാക്ഷനിലൂടെ ഉപയോക്താക്കൾക്ക് ഭാരം, യൂണിറ്റ് വില, മൊത്തത്തിലുള്ള വില, ടാരെ തുടങ്ങിയ കൗണ്ടിംഗ് ഡിസ്പ്ലേ ഫംഗ്ഷനുകൾ എളുപ്പത്തിൽ മനസ്സിലാക്കാൻ കഴിയും. ., അതുപോലെ തന്നെ എണ്ണൽ, ഭാരം മാറ്റുന്ന വളവുകൾ ട്രാക്കുചെയ്യൽ, തൂക്കത്തിൻ്റെ കൃത്യത ശരിയാക്കൽ തുടങ്ങിയവയുടെ പ്രവർത്തനങ്ങൾ, അങ്ങനെ സൗകര്യപ്രദവും കാര്യക്ഷമവുമായ വെയ്റ്റിംഗ് അനുഭവം ആസ്വദിക്കുന്നതിന് വ്യത്യസ്ത ആപ്ലിക്കേഷൻ സാഹചര്യങ്ങൾക്കിടയിൽ മാറുന്നത് എളുപ്പമാണ്.
1. യുഐ വികസനം
![f26af533d43728cd210e0f7af5e7acc](https://ecdn6.globalso.com/upload/p/1355/source/2024-06/665f077223d2b27894.png)
2.C51 ഡിസൈൻ
വിലനിർണ്ണയ ഫംഗ്ഷൻ നടപ്പിലാക്കുന്നതിനുള്ള തൂക്കക്കാരൻ്റെ റഫറൻസ് കോഡിൻ്റെ ഒരു ഭാഗം ഇപ്രകാരമാണ്:
// വിലനിർണ്ണയ പേജ്=====================
#നിർവ്വചിക്കുക VALUATION_UNIT_PRICE_ADDR 0x1010
#VALUATION_GRAM_ADDR 0x1000 നിർവ്വചിക്കുക
#നിർവ്വചിക്കുക VALUATION_TOTAL_PRICES_ADDR 0x1020
uint32_t valuation_decorticate = 0; // വിലനിർണ്ണയം ടാരെ വെയ്റ്റ്
uint32_t valuation_unit_price = 0; //യൂണിറ്റ് വില
// യൂണിറ്റ് വില പുതുക്കുക
void page_valuation_unit_price_refresh()
{
uint8_t test_display[10] = {0};
എങ്കിൽ (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);
}
അല്ലെങ്കിൽ (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);
}
അല്ലെങ്കിൽ (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);
}
അല്ലെങ്കിൽ (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);
}
}
// ഭാരം പുതുക്കുക
void 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);
}
അല്ലാത്തപക്ഷം (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);
}
അല്ലാത്തപക്ഷം (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);
}
അല്ലാത്തപക്ഷം (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);
}
അല്ലാത്തപക്ഷം (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);
}
}
വേറെ
{
dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);
}
}
// ആകെ വില പുതുക്കൽ
അസാധുവായ page_valuation_price_refresh()
{
uint32_t price_value = 0;
uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};
if(gram_value >= valuation_decorticate)
{
price_value = (gram_value - valuation_decorticate) * valuation_unit_price * 2 / 1000;
എങ്കിൽ (price_value
{
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);
}
ഇല്ലെങ്കിൽ (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);
}
ഇല്ലെങ്കിൽ (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);
}
ഇല്ലെങ്കിൽ (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);
}
}
വേറെ
{
dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);
}
}
void page_valuation_decorticate()
{
valuation_decorticate = gram_value;
page_valuation_weight_refresh();
}
അസാധുവായ page_valuation_1()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 1;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_2()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 2;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_3()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 3;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_4()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 4;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_5()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 5;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_6()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 6;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_7()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 7;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_8()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 8;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_9()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 9;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ page_valuation_0()
{
എങ്കിൽ (valuation_unit_price
{
valuation_unit_price = valuation_unit_price * 10 + 0;
page_valuation_unit_price_refresh();
}
}
അസാധുവായ 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();
}
പോസ്റ്റ് സമയം: ഏപ്രിൽ-28-2024