[ओपन सोर्स] मल्टीफंक्शनल वजनाचे उपकरण

——DWIN डेव्हलपर फोरम कडून

या अंकात, आम्ही DWIN डेव्हलपर फोरम - मल्टी-फंक्शन वेजरचा पुरस्कार-विजेता ओपन-सोर्स केस पुश करतो. अभियंता 4-इंचाची COF स्मार्ट स्क्रीन स्वीकारतो आणि T5L OS कोअर आणि HX711 मॉड्यूल आणि 5kg प्रेशर सेन्सर सेट यांच्यातील डेटा परस्परसंवादाद्वारे, वापरकर्ते वजन, युनिट किंमत, एकूण किंमत, टायर इत्यादी मोजणी डिस्प्ले फंक्शन्स सहज ओळखू शकतात. ., तसेच मोजणीची कार्ये, वजन बदल वक्रांचा मागोवा घेणे आणि वजन अचूकता दुरुस्त करणे इत्यादी, जेणेकरून सोयीस्कर आणि कार्यक्षम वजन अनुभवाचा आनंद घेण्यासाठी विविध अनुप्रयोग परिस्थितींमध्ये स्विच करणे सोपे होईल.

1. UI विकास

f26af533d43728cd210e0f7af5e7acc

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};

जर(मूल्यांकन_युनिट_किंमत

{

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);

}

अन्यथा जर(मूल्यांकन_युनिट_किंमत

{

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);

}

अन्यथा (मूल्यांकन_युनिट_किंमत

{

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);

}

अन्यथा जर(मूल्यांकन_युनिट_किंमत

{

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;

जर(ग्राम_मूल्य >= मूल्यांकन_सजावट)

{

gram_display = gram_value - valuation_decorticate;

जर (ग्राम_डिस्प्ले

{

test_display[0] = gram_display / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

अन्यथा जर (ग्राम_डिस्प्ले

{

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);

}

अन्यथा जर (ग्राम_डिस्प्ले

{

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);

}

अन्यथा जर (ग्राम_डिस्प्ले

{

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);

}

अन्यथा जर (ग्राम_डिस्प्ले

{

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);

}

}

 

// एकूण किंमत रिफ्रेश

void page_valuation_price_refresh()

{

uint32_t किंमत_मूल्य = 0;

uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};

जर(ग्राम_मूल्य >= मूल्यांकन_सजावट)

{

price_value = (gram_value - valuation_decorticate) * valuation_unit_price * 2 / 1000;

जर(किंमत_मूल्य

{

चाचणी_प्रदर्शन[0] = किंमत_मूल्य / 100 % 10 + 0x30;

test_display[1] = '.';

चाचणी_प्रदर्शन[2] = किंमत_मूल्य / 10 % 10 + 0x30;

चाचणी_प्रदर्शन[3] = किंमत_मूल्य / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

अन्यथा जर (किंमत_मूल्य

{

चाचणी_प्रदर्शन[0] = किंमत_मूल्य / 1000 % 10 + 0x30;

चाचणी_प्रदर्शन[1] = किंमत_मूल्य / 100 % 10 + 0x30;

test_display[2] = '.';

चाचणी_प्रदर्शन[3] = किंमत_मूल्य / 10 % 10 + 0x30;

चाचणी_प्रदर्शन[4] = किंमत_मूल्य / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

अन्यथा जर(किंमत_मूल्य

{

चाचणी_प्रदर्शन[0] = किंमत_मूल्य / 10000 % 10 + 0x30;

चाचणी_प्रदर्शन[1] = किंमत_मूल्य / 1000 % 10 + 0x30;

चाचणी_प्रदर्शन[2] = किंमत_मूल्य / 100% 10 + 0x30;

test_display[3] = '.';

चाचणी_प्रदर्शन[4] = किंमत_मूल्य / 10% 10 + 0x30;

चाचणी_प्रदर्शन[5] = किंमत_मूल्य / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

अन्यथा जर(किंमत_मूल्य

{

चाचणी_प्रदर्शन[0] = किंमत_मूल्य / 100000 % 10 + 0x30;

चाचणी_प्रदर्शन[1] = किंमत_मूल्य / 10000 % 10 + 0x30;

चाचणी_प्रदर्शन[2] = किंमत_मूल्य / 1000 % 10 + 0x30;

चाचणी_प्रदर्शन[3] = किंमत_मूल्य / 100% 10 + 0x30;

test_display[4] = '.';

चाचणी_प्रदर्शन[5] = किंमत_मूल्य / 10 % 10 + 0x30;

चाचणी_प्रदर्शन[6] = किंमत_मूल्य / 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 = ग्राम_मूल्य;

page_valuation_weight_refresh();

}

void page_valuation_1()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 1;

page_valuation_unit_price_refresh();

}

}

void page_valuation_2()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 2;

page_valuation_unit_price_refresh();

}

}

void page_valuation_3()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 3;

page_valuation_unit_price_refresh();

}

}

void page_valuation_4()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 4;

page_valuation_unit_price_refresh();

}

}

void page_valuation_5()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 5;

page_valuation_unit_price_refresh();

}

}

void page_valuation_6()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 6;

page_valuation_unit_price_refresh();

}

}

void page_valuation_7()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 7;

page_valuation_unit_price_refresh();

}

}

void page_valuation_8()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 8;

page_valuation_unit_price_refresh();

}

}

void page_valuation_9()

{

जर(मूल्यांकन_युनिट_किंमत

{

valuation_unit_price = valuation_unit_price * 10 + 9;

page_valuation_unit_price_refresh();

}

}

void page_valuation_0()

{

जर(मूल्यांकन_युनिट_किंमत

{

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();

}


पोस्ट वेळ: एप्रिल-28-2024