[Louvri sous] Aparèy Peze Multifonksyonèl

——Soti nan DWIN Developer Forum

Nan pwoblèm sa a, nou pouse ka sous louvri DWIN Developer Forum - Multi-function Weigher. Enjenyè a adopte yon ekran entelijan COF 4 pous, epi atravè entèraksyon done ant nwayo T5L OS ak modil HX711 ak seri Capteur presyon 5kg, itilizatè yo ka fasilman reyalize fonksyon ekspozisyon konte tankou pwa, pri inite, pri total, tare, elatriye. ., osi byen ke fonksyon yo nan konte, swiv nan koub chanjman pwa, ak korije nan presizyon peze, elatriye, se konsa ke li se fasil chanje ant senaryo aplikasyon diferan yo jwi yon eksperyans pratik ak efikas peze.

1. Devlopman UI

f26af533d43728cd210e0f7af5e7acc

2.C51 Design

Pati nan kòd referans pou peze a aplike fonksyon pri a se jan sa a:

// Paj Prix====================

#defini VALUATION_UNIT_PRICE_ADDR 0x1010

#defini VALUATION_GRAM_ADDR 0x1000

#defini VALUATION_TOTAL_PRICES_ADDR 0x1020

uint32_t valyasyon_decorticate = 0; // Pri Pwa Tare

uint32_t valuation_unit_price = 0; //Pri inite

// Pri inite rafrechi

void page_valuation_unit_price_refresh()

{

uint8_t test_display[10] = {0};

si(pri_inite_valyasyon

{

tès_display[0] = pri_unite_valyasyon / 100 % 10 + 0x30;

test_display[1] = '.';

tès_display[2] = pri_unite_valyasyon / 10 % 10 + 0x30;

tès_display[3] = pri_unite_valyasyon / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

else if(valuation_unit_price

{

tès_display[0] = pri_unite_valyasyon / 1000 % 10 + 0x30;

tès_display[1] = pri_unite_valyasyon / 100 % 10 + 0x30;

test_display[2] = '.';

tès_display[3] = pri_unite_valyasyon / 10 % 10 + 0x30;

tès_display[4] = valuation_unit_price / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

else if(valuation_unit_price

{

tès_display[0] = pri_unite_valyasyon / 10000 % 10 + 0x30;

tès_display[1] = pri_unite_valyasyon / 1000 % 10 + 0x30;

tès_display[2] = pri_unite_valyasyon / 100 % 10 + 0x30;

test_display[3] = '.';

tès_display[4] = pri_unite_valyasyon / 10 % 10 + 0x30;

tès_display[5] = pri_unite_valyasyon / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

else if(valuation_unit_price

{

tès_display[0] = pri_unite_valyasyon / 100000 % 10 + 0x30;

tès_display[1] = pri_unite_valyasyon / 10000 % 10 + 0x30;

tès_display[2] = pri_unite_valyasyon / 1000 % 10 + 0x30;

tès_display[3] = valuation_unit_price / 100 % 10 + 0x30;

test_display[4] = '.';

tès_display[5] = valuation_unit_price / 10 % 10 + 0x30;

tès_display[6] = valuation_unit_price / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

}

 

// Rafrechi pwa

void page_valuation_weight_refresh()

{

uint8_t test_display[10] = {0x30};

uint32_t gram_display = 0;

if(valè_gram>= valyasyon_decorticate)

{

gram_display = gram_value - valyasyon_decorticate;

if(gram_display

{

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

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

else if(gram_display

{

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

tès_display[1] = gram_display / 1% 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

else if(gram_display

{

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

tès_display[1] = gram_display / 10% 10 + 0x30;

tès_display[2] = gram_display / 1% 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

else if(gram_display

{

tès_display[0] = gram_display / 1000% 10 + 0x30;

tès_display[1] = gram_display / 100% 10 + 0x30;

tès_display[2] = gram_display / 10% 10 + 0x30;

tès_display[3] = gram_display / 1% 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

else if(gram_display

{

tès_display[0] = gram_display / 10000% 10 + 0x30;

tès_display[1] = gram_display / 1000 % 10 + 0x30;

tès_display[2] = gram_display / 100% 10 + 0x30;

tès_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);

}

}

lòt bagay

{

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

}

 

// Pri total rafrechi

void page_valuation_price_refresh()

{

uint32_t price_value = 0;

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

if(valè_gram>= valyasyon_decorticate)

{

price_value = (valè_gram - valuation_decorticate) * valuation_unit_price * 2 / 1000;

si(pri_valè

{

tès_display[0] = price_value / 100 % 10 + 0x30;

test_display[1] = '.';

tès_display[2] = price_value / 10 % 10 + 0x30;

tès_display[3] = price_value / 1% 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

else if(pri_valè

{

tès_display[0] = price_value / 1000 % 10 + 0x30;

tès_display[1] = price_value / 100 % 10 + 0x30;

test_display[2] = '.';

tès_display[3] = price_value / 10 % 10 + 0x30;

tès_display[4] = price_value / 1% 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

else if (pri_valè

{

tès_display[0] = price_value / 10000 % 10 + 0x30;

tès_display[1] = price_value / 1000 % 10 + 0x30;

tès_display[2] = price_value / 100 % 10 + 0x30;

test_display[3] = '.';

tès_display[4] = price_value / 10 % 10 + 0x30;

tès_display[5] = price_value / 1% 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

else if(pri_valè

{

tès_display[0] = price_value / 100000 % 10 + 0x30;

tès_display[1] = price_value / 10000 % 10 + 0x30;

tès_display[2] = price_value / 1000 % 10 + 0x30;

tès_display[3] = price_value / 100 % 10 + 0x30;

test_display[4] = '.';

tès_display[5] = price_value / 10 % 10 + 0x30;

tès_display[6] = price_value / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

}

lòt bagay

{

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

}

void page_valuation_decorticate()

{

valuation_decorticate = gram_value;

page_valuation_weight_refresh();

}

void page_valuation_1()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 1;

page_valuation_unit_price_refresh();

}

}

void page_valuation_2()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 2;

page_valuation_unit_price_refresh();

}

}

void page_valuation_3()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 3;

page_valuation_unit_price_refresh();

}

}

void page_valuation_4()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 4;

page_valuation_unit_price_refresh();

}

}

void page_valuation_5()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 5;

page_valuation_unit_price_refresh();

}

}

void page_valuation_6()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 6;

page_valuation_unit_price_refresh();

}

}

void page_valuation_7()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 7;

page_valuation_unit_price_refresh();

}

}

void page_valuation_8()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 8;

page_valuation_unit_price_refresh();

}

}

void page_valuation_9()

{

si(pri_inite_valyasyon

{

valuation_unit_price = valuation_unit_price * 10 + 9;

page_valuation_unit_price_refresh();

}

}

void page_valuation_0()

{

si(pri_inite_valyasyon

{

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

{

pri_unite_valyasyon = 0;

page_valuation_unit_price_refresh();

}


Tan poste: Apr-28-2024