Skip to content

Commit

Permalink
LCD display stabilization LYWSD03MMC HW:B1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
pvvx committed Jun 19, 2023
1 parent 20a087d commit 62c246d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 10 deletions.
Binary file modified ATC_v43.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ The download of the appropriate firmware for your device will be presented autom
* [MHO-C122 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/MHO_C122_v43.bin) ([2AWMOMHOC122](https://github.com/pvvx/ATC_MiThermometer/issues/339))
* [MHO-C401 2020-2021 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/MHO_C401_v43.bin) (manufacturer Xiaomi, not [Azarton](https://github.com/pvvx/ATC_MiThermometer/issues/114)!)
* [MHO-C401 2022 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/MHO_C401N_v43.bin) (manufacturer Xiaomi and [Azarton](https://github.com/pvvx/ATC_MiThermometer/issues/114))
* [CGG1-M 2020-2021 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/CGG1_v42.bin) ([CGG1-M](https://github.com/pvvx/ATC_MiThermometer/issues/41#issuecomment-812803456))
* [CGG1-M 2020-2021 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/CGG1_v43.bin) ([CGG1-M](https://github.com/pvvx/ATC_MiThermometer/issues/41#issuecomment-812803456))
* [CGG1-M 2022 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/CGG1M_v43.bin) ([CGG1-M](https://github.com/pvvx/ATC_MiThermometer/issues/41#issuecomment-812803456))
* [CGDK2 Custom Firmware Version 4.3](https://github.com/pvvx/ATC_MiThermometer/raw/master/CGDK2_v43.bin) ([CGDK2](https://pvvx.github.io/CGDK2))

Expand Down Expand Up @@ -210,7 +210,7 @@ In case you want to go back to the original firmware, you can download them here
| 4.0 | Improved stability in connected mode. I2C bus CLK and PullUp correction.|
| 4.1 | Changed "connection latency" for [stability in connected](https://github.com/pvvx/ATC_MiThermometer/issues/265#issuecomment-1431495494).|
| 4.2 | Option Increasing Communication Distance: Bluetooth 5.0 LE Long Range (Advertising Extensions: primary and secondary Coded PHY S=8, Connectable). Added support [MHO-C401 (2022.11)](https://pvvx.github.io/MHO_C401N) and [MJWSD05MMC](https://pvvx.github.io/MJWSD05MMC). Added function key: Connect |
| 4.3 | Increasing the degree of averaging (x64) of the sent values over the battery. Added "Screen Off" option. Check HW: B1.5. Added MHO-C122 (2AWMOMHOC122) test support. |
| 4.3 | Increasing the degree of averaging (x64) of the sent values over the battery. Added "Screen Off" option. Check LYWSD03MMC HW: B1.5. Added MHO-C122 (2AWMOMHOC122) test support. LCD display stabilization LYWSD03MMC HW:B1.9 |

## Applications

Expand Down
5 changes: 2 additions & 3 deletions firmware.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{"version": 66, "betaver": 67,
"custom":["ATC_v42.bin", "MHO_C401_v42.bin", "CGG1_v42.bin", "ATC_v42.bin", "ATC_v42.bin", "ATC_v42.bin", "CGDK2_v42.bin", "CGG1M_v42.bin","MHO_C401N_v42.bin","BTH_v42.bin","ATC_v42.bin","?","?","?","?","?"],
"betafw":["ATC_v43.bin", "MHO_C401_v43.bin", "CGG1_v43.bin", "ATC_v43.bin", "ATC_v43.bin", "ATC_v43.bin", "CGDK2_v43.bin", "CGG1M_v43.bin","MHO_C401N_v43.bin","BTH_v43.bin","ATC_v43.bin","MHO_C122_v43.bin","?","?","?","?"],
{"version": 67, "betaver": 68,
"custom":["ATC_v43.bin", "MHO_C401_v43.bin", "CGG1_v43.bin", "ATC_v43.bin", "ATC_v43.bin", "ATC_v43.bin", "CGDK2_v43.bin", "CGG1M_v43.bin","MHO_C401N_v43.bin","BTH_v43.bin","ATC_v43.bin","MHO_C122_v43.bin","?","?","?","?"],
"original":["Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin","Original_OTA_Xiaomi_MHO_C401_v1.0.0_0010.bin","Original_OTA_CGG1_v1.0.1_0093.bin","Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin","Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin","Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin", "Original_OTA_CGDK2_v1.1.1_0217.bin", "Original_OTA_CGG1M_v2.2.1.bin","Original_OTA_Xiaomi_MHO_C401_v1.0.0_0016.bin","Original_OTA_Xiaomi_MJWSD05MMC_v2.0.0_0026.bin","Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin","Original_OTA_MHO_C122_tuya.bin","?","?","?","?"]}
4 changes: 4 additions & 0 deletions src/boot.link
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ SECTIONS
*(.bss.*)
}
PROVIDE(_end_bss_ = .);
/*
PROVIDE(hci_rx_fifo = .);
PROVIDE(hci_tx_fifo = .);
*/

PROVIDE(_bin_size_ = _code_size_ + _end_data_ - _start_data_);
}
6 changes: 3 additions & 3 deletions src/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void update_lcd(void){
lcd_flg.b.send_notify = lcd_flg.b.notify_on; // set flag LCD for send notify
}
}
#endif
#endif // !USE_EPD

_attribute_ram_code_
uint8_t is_comfort(int16_t t, uint16_t h) {
Expand Down Expand Up @@ -97,7 +97,7 @@ void lcd(void) {
#if (DEVICE_TYPE != DEVICE_CGDK2)
show_smiley(0); // stage clock/blinking and blinking on
#endif
#endif
#endif // USE_CLOCK
}
#if (DEVICE_TYPE != DEVICE_CGDK2)
else
Expand Down Expand Up @@ -156,7 +156,7 @@ void lcd(void) {
#if (DEVICE_TYPE != DEVICE_CGDK2)
show_smiley(0); // stage blinking and blinking on
#endif
#endif
#endif // USE_CLOCK
} else {
#if (DEVICE_TYPE != DEVICE_CGDK2)
if (cfg.flg.comfort_smiley) { // comfort on
Expand Down
35 changes: 33 additions & 2 deletions src/lcd_lywsd03mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ void send_to_lcd(void){
gpio_setup_up_down_resistor(I2C_SCL, PM_PIN_PULLUP_10K);
gpio_setup_up_down_resistor(I2C_SDA, PM_PIN_PULLUP_10K);
}
reg_i2c_id = lcd_i2c_addr;
if (lcd_i2c_addr == (B14_I2C_ADDR << 1)) {
// B1.4, B1.7, B2.0
reg_i2c_id = lcd_i2c_addr;
reg_i2c_adr_dat = 0x4080;
reg_i2c_ctrl = FLD_I2C_CMD_START | FLD_I2C_CMD_ID | FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO;
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
Expand All @@ -173,6 +173,36 @@ void send_to_lcd(void){
reg_i2c_ctrl = FLD_I2C_CMD_STOP;
} else { // (lcd_i2c_addr == (B19_I2C_ADDR << 1))
// B1.9 BU9792AFUV
#if 1
for(buff_index = 0; buff_index < sizeof(display_buff); buff_index++)
utxb.data[buff_index] = reverse(*p++);
p = utxb.data;
reg_i2c_id = lcd_i2c_addr;
reg_i2c_adr = 0x04; // addr: 4
reg_i2c_do = *p++;
reg_i2c_di = *p++;
reg_i2c_ctrl = FLD_I2C_CMD_ID | FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO | FLD_I2C_CMD_DI | FLD_I2C_CMD_START;
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
reg_i2c_adr_dat = 0;
reg_i2c_ctrl = FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO;
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
reg_i2c_adr = *p++;
reg_i2c_do = *p++;
reg_i2c_ctrl = FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO;
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
reg_i2c_adr_dat = 0;
reg_i2c_ctrl = FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO;
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
reg_i2c_adr = *p++;
reg_i2c_do = *p;
reg_i2c_ctrl = FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO | FLD_I2C_CMD_STOP;
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
// LCD cmd: 0xc8 - Mode Set (MODE SET): Display ON, 1/3 Bias
reg_i2c_adr = 0xC8;
reg_i2c_ctrl = FLD_I2C_CMD_START | FLD_I2C_CMD_ID | FLD_I2C_CMD_ADDR | FLD_I2C_CMD_STOP;

#else
reg_i2c_id = lcd_i2c_addr;
reg_i2c_adr = 0x04; // addr: 4
reg_i2c_do = reverse(*p++);
reg_i2c_di = reverse(*p++);
Expand All @@ -191,10 +221,11 @@ void send_to_lcd(void){
reg_i2c_adr = reverse(*p++);
reg_i2c_do = reverse(*p);
reg_i2c_ctrl = FLD_I2C_CMD_ADDR | FLD_I2C_CMD_DO | FLD_I2C_CMD_STOP;
#endif
}
while (reg_i2c_status & FLD_I2C_CMD_BUSY);
} else {
// B1.6 (UART LCD)
// B1.5, B1.6 (UART LCD)
utxb.data[5] = *p++;
utxb.data[4] = *p++;
utxb.data[3] = *p++;
Expand Down

0 comments on commit 62c246d

Please sign in to comment.