[Open source] Mea Weighing Multifunctional

——Mai DWIN Developer Forum

Ma kēia pukana, ke koi nei mākou i ka hihia open-source lanakila-lanakila o DWIN Developer Forum - Multi-function Weigher. Hoʻohana ka ʻenekinia i kahi pale akamai COF 4-inch, a ma o ka pilina ʻikepili ma waena o T5L OS core a me HX711 module a me 5kg pressure sensor set, hiki i nā mea hoʻohana ke hoʻomaopopo maʻalahi i nā hana hōʻike helu e like me ke kaumaha, ke kumu kūʻai, ke kumu kūʻai, ka tare, etc. ., a me nā hana o ka helu ʻana, ka nānā ʻana i nā pihi hoʻololi kaumaha, a me ka hoʻoponopono ʻana i ka pololei o ke kaupaona ʻana, a me nā mea ʻē aʻe, i maʻalahi ke hoʻololi i waena o nā hiʻohiʻona noiʻi like ʻole e leʻaleʻa i kahi ʻike kūpono a kūpono hoʻi.

1. Hoʻomohala UI

f26af533d43728cd210e0f7af5e7acc

2.C51 Hoʻolālā

ʻO ka ʻāpana o ke code kuhikuhi no ka mea kaupaona e hoʻokō ai i ka hana kumu kūʻai penei:

// ʻAoʻao Kumukuai ====================

#define VALUATION_UNIT_PRICE_ADDR 0x1010

#define VALUATION_GRAM_ADDR 0x1000

#define VALUATION_TOTAL_PRICES_ADDR 0x1020

uint32_t valuation_decorticate = 0; // Ke Kumukūʻai ʻana i ke Kauona Tare

uint32_t valuation_unit_price = 0; //Ui Hui

// Hoʻohou i ke kumu kūʻai

hoʻopau i ka page_valuation_unit_price_refresh()

{

uint8_t test_display[10] = {0};

inā(kumukūʻai_unit_helu

{

hōʻike_hōʻike[0] = valuation_unit_price / 100 % 10 + 0x30;

hōʻike_hōʻike[1] = '.';

hōʻike_hōʻike[2] = valuation_unit_price / 10 % 10 + 0x30;

hōʻike_hōʻike[3] = valuation_unit_price / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

'ē aʻe inā(helu_unit_kumu

{

hōʻike_hōʻike[0] = valuation_unit_price / 1000 % 10 + 0x30;

hōʻike_hōʻike[1] = kumu kūʻai_unit_helu / 100 % 10 + 0x30;

hōʻike_hōʻike [2] = '.';

hōʻike_hōʻike[3] = valuation_unit_price / 10 % 10 + 0x30;

hōʻike_hōʻike[4] = valuation_unit_price / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

'ē aʻe inā(helu_unit_kumu

{

hōʻike_hōʻike[0] = valuation_unit_price / 10000 % 10 + 0x30;

hōʻike_hōʻike[1] = kumu kūʻai_unit_helu / 1000 % 10 + 0x30;

hōʻike_hōʻike[2] = valuation_unit_price / 100 % 10 + 0x30;

hōʻike_hōʻike[3] = '.';

hōʻike_hōʻike[4] = valuation_unit_price / 10 % 10 + 0x30;

hōʻike_hōʻike[5] = valuation_unit_price / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

inā ʻaʻole (kumu_unit_helu

{

hōʻike_hōʻike[0] = valuation_unit_price / 100000 % 10 + 0x30;

hōʻike_hōʻike[1] = kumu kūʻai_unit_helu / 10000 % 10 + 0x30;

hōʻike_hōʻike[2] = kumu kūʻai_unit_helu / 1000 % 10 + 0x30;

hōʻike_hōʻike[3] = kumu kūʻai_unit_helu / 100 % 10 + 0x30;

hōʻike_hōʻike[4] = '.';

hōʻike_hōʻike[5] = valuation_unit_price / 10 % 10 + 0x30;

hōʻike_hōʻike[6] = valuation_unit_price / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

}

 

// Kaumaha hou

ʻaʻohe ʻaoʻao_valuation_weight_refresh()

{

uint8_t test_display[10] = {0x30};

uint32_t gram_display = 0;

inā(gram_value >= valuation_decorticate)

{

gram_display = gram_value - valuation_decorticate;

inā(gram_display

{

hōʻike_hōʻike[0] = gram_hōʻikeʻike / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

inā ʻaʻole (gram_display

{

hōʻike_hōʻike[0] = gram_hōʻikeʻike / 10 % 10 + 0x30;

ho'āʻo_hōʻike[1] = gram_hōʻikeʻike / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

inā ʻaʻole (gram_display

{

hōʻike_hōʻike[0] = gram_hōʻikeʻike / 100 % 10 + 0x30;

hōʻike_hōʻike[1] = gram_hōʻikeʻike / 10 % 10 + 0x30;

ho'āʻo_hōʻike[2] = gram_hōʻikeʻike / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

inā ʻaʻole (gram_display

{

hōʻike_hōʻike[0] = gram_hōʻikeʻike / 1000 % 10 + 0x30;

ho'āʻo_hōʻike[1] = gram_hōʻikeʻike / 100 % 10 + 0x30;

ho'āʻo_hōʻike[2] = gram_hōʻikeʻike / 10 % 10 + 0x30;

ho'āʻo_hōʻike[3] = gram_hōʻikeʻike / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

inā ʻaʻole (gram_display

{

hōʻike_hōʻike[0] = gram_hōʻikeʻike / 10000 % 10 + 0x30;

ho'āʻo_hōʻike[1] = gram_hōʻikeʻike / 1000 % 10 + 0x30;

ho'āʻo_hōʻike[2] = gram_hōʻikeʻike / 100 % 10 + 0x30;

ho'āʻo_hōʻike[3] = gram_hōʻikeʻike / 10 % 10 + 0x30;

ho'āʻo_hōʻike[4] = gram_hōʻikeʻike / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

}

ʻē aʻe

{

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

}

 

// Huina Kumukuai Hou

hoʻopau i ka ʻaoʻao_valuation_price_refresh()

{

uint32_t price_value = 0;

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

inā(gram_value >= valuation_decorticate)

{

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

inā(kumu_waiwai

{

hōʻike_hōʻike[0] = ka waiwai_kuai / 100 % 10 + 0x30;

hōʻike_hōʻike[1] = '.';

hōʻike_hōʻike[2] = waiwai_kuai / 10 % 10 + 0x30;

hōʻike_hōʻike[3] = kumu kūʻai_waiwai / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, hōʻike_hōʻike, 4);

}

'ē aʻe inā (kumu_waiwai

{

hōʻike_hōʻike[0] = kumu kūʻai_waiwai / 1000 % 10 + 0x30;

hōʻike_hōʻike[1] = waiwai_kuai / 100 % 10 + 0x30;

hōʻike_hōʻike [2] = '.';

hōʻike_hōʻike[3] = kumu kūʻai_waiwai / 10 % 10 + 0x30;

hōʻike_hōʻike[4] = kumu kūʻai_waiwai / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, hōʻike_hōʻike, 4);

}

'ē aʻe inā (kumu_waiwai

{

hōʻike_hōʻike[0] = kumu_kuai / 10000 % 10 + 0x30;

hōʻike_hōʻike[1] = kumu kūʻai / 1000 % 10 + 0x30;

hōʻike_hōʻike[2] = kumu_kuai / 100 % 10 + 0x30;

hōʻike_hōʻike[3] = '.';

hōʻike_hōʻike[4] = ka waiwai_kuai / 10 % 10 + 0x30;

hōʻike_hōʻike[5] = waiwai_kuai / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, hōʻike_hōʻike, 4);

}

ʻē aʻe inā(kumu_waiwai

{

hōʻike_hōʻike[0] = kumu kūʻai_waiwai / 100000 % 10 + 0x30;

hōʻike_hōʻike[1] = kumu kūʻai / 10000 % 10 + 0x30;

hōʻike_hōʻike[2] = kumu_kuai / 1000 % 10 + 0x30;

hōʻike_hōʻike[3] = ka waiwai_kuai / 100 % 10 + 0x30;

hōʻike_hōʻike[4] = '.';

hōʻike_hōʻike[5] = kumu kūʻai_waiwai / 10 % 10 + 0x30;

hōʻike_hōʻike[6] = kumu kūʻai_waiwai / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, hōʻike_hōʻike, 4);

}

}

ʻē aʻe

{

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, hōʻike_hōʻike, 4);

}

}

hoʻopau ʻaoʻao_valuation_decorticate()

{

valuation_decorticate = gram_value;

page_valuation_weight_refresh();

}

hoʻopau ʻaoʻao_valuation_1()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 1;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_2()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 2;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_3()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 3;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_4()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 4;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_5()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 5;

page_valuation_unit_price_refresh();

}

}

ʻaʻohe ʻaoʻao_valuation_6()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 6;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_7()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 7;

page_valuation_unit_price_refresh();

}

}

ʻaʻohe ʻaoʻao_valuation_8()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 8;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_9()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 9;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_0()

{

inā(kumukūʻai_hui_nui

{

valuation_unit_price = valuation_unit_price * 10 + 0;

page_valuation_unit_price_refresh();

}

}

hoʻopau ʻaoʻao_valuation_back()

{

valuation_unit_price = valuation_unit_price / 10;

page_valuation_unit_price_refresh();

}

hoʻopau ʻaoʻao_valuation_clear()

{

valuation_unit_price = 0;

page_valuation_unit_price_refresh();

}


Ka manawa hoʻouna: Apr-28-2024