[اوپن سورس] ملٽي فنڪشنل وزني ڊيوائس

—— DWIN ڊولپر فورم کان

هن مسئلي ۾، اسان انعام کٽڻ وارو اوپن سورس ڪيس DWIN ڊولپر فورم - ملٽي فنڪشن وزنر کي ڌڪايو. انجنيئر 4 انچ جي COF سمارٽ اسڪرين کي اختيار ڪري ٿو، ۽ T5L OS ڪور ۽ HX711 ماڊل ۽ 5kg پريشر سينسر سيٽ جي وچ ۾ ڊيٽا جي رابطي جي ذريعي، صارفين کي آساني سان ڳڻپ جي ڊسپلي افعال کي محسوس ڪري سگھن ٿا جهڙوڪ وزن، يونٽ جي قيمت، ڪل قيمت، ٽائر، وغيره. .، انهي سان گڏ ڳڻپ جا ڪم، وزن جي تبديلي جي وکر کي ٽريڪ ڪرڻ، ۽ وزن جي درستگي کي درست ڪرڻ، وغيره، انهي ڪري اهو آسان آهي ته مختلف ايپليڪيشن منظرنامن جي وچ ۾ سوئچ ڪرڻ لاء آسان ۽ موثر وزن جي تجربي مان لطف اندوز ٿيڻ لاء.

1. UI ترقي

f26af533d43728cd210e0f7af5e7acc

2.C51 ڊيزائن

قيمت جي فنڪشن کي لاڳو ڪرڻ لاء وزن جي حوالي سان ڪوڊ جو حصو هن ريت آهي:

// قيمت جو صفحو==================

# define VALUATION_UNIT_PRICE_ADDR 0x1010

وضاحت ڪريو VALUATION_GRAM_ADDR 0x1000

# define 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؛

جيڪڏهن (gram_value >= قدر_سجاڳي)

{

gram_display = گرام_قدر - قدر_سجاڳي؛

جيڪڏهن (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] = گرام_ڊسپلي / 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] = گرام_ڊسپلي / 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 price_value = 0؛

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

جيڪڏهن (gram_value >= قدر_سجاڳي)

{

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

جيڪڏهن (قيمت_قدر

{

test_display[0] = قيمت_قيمت / 100% 10 + 0x30؛

test_display[1] = '.'؛

test_display[2] = قيمت_قيمت / 10% 10 + 0x30؛

test_display[3] = قيمت_قيمت / 1% 10 + 0x30؛

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

ٻيو جيڪڏهن (قيمت_قدر

{

test_display[0] = قيمت_قيمت / 1000% 10 + 0x30؛

test_display[1] = قيمت_قيمت / 100% 10 + 0x30؛

test_display[2] = '.'؛

test_display[3] = قيمت_قيمت / 10% 10 + 0x30؛

test_display[4] = قيمت_قيمت / 1% 10 + 0x30؛

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

ٻيو جيڪڏهن (قيمت_قدر

{

test_display[0] = قيمت_قيمت / 10000 % 10 + 0x30؛

test_display[1] = قيمت_قيمت / 1000 % 10 + 0x30؛

test_display[2] = قيمت_قيمت / 100% 10 + 0x30؛

test_display[3] = '.'؛

test_display[4] = قيمت_قيمت / 10% 10 + 0x30؛

test_display[5] = قيمت_قيمت / 1% 10 + 0x30؛

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

ٻيو جيڪڏهن (قيمت_قدر

{

test_display[0] = قيمت_قيمت / 100000 % 10 + 0x30؛

test_display[1] = قيمت_قيمت / 10000 % 10 + 0x30؛

test_display[2] = قيمت_قيمت / 1000 % 10 + 0x30؛

test_display[3] = قيمت_قيمت / 100% 10 + 0x30؛

test_display[4] = '.'؛

test_display[5] = قيمت_قيمت / 10% 10 + 0x30؛

test_display[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 = valuation_unit_price * 10 + 1؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_2()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 2؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_3()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 3؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_4()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 4؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_5()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 5؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_6()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 6؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_7()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 7؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_8()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 8؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_9()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 9؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_0()

{

جيڪڏهن (valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 0؛

page_valuation_unit_price_refresh();

}

}

void page_valuation_back()

{

valuation_unit_price = قدر_يونٽ_قيمت / 10؛

page_valuation_unit_price_refresh();

}

void page_valuation_clear()

{

valuation_unit_price = 0؛

page_valuation_unit_price_refresh();

}


پوسٽ جو وقت: اپريل-28-2024