Browse Source

update cht8305

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 years ago
parent
commit
171b3cca79
1 changed files with 6 additions and 4 deletions
  1. 6 4
      Application/bsp/cht8305.c

+ 6 - 4
Application/bsp/cht8305.c

@@ -28,10 +28,12 @@ void cht8305_reset(void) {
 		state_debug("cht8305 not ready reinit\n");
 		cht8305_init();
 	}
-	u16 data = 0x8000; //reset
-	i2c_write(Config_Reg, data);
-	i2c_read(Config_Reg, &data);
-	state_debug("data = 0x%x\n", data);	
+	if (_ready) {
+		u16 data = 0x8000; //reset
+		i2c_write(Config_Reg, data);
+		i2c_read(Config_Reg, &data);
+		state_debug("data = 0x%x\n", data);	
+	}
 }
 
 u8 cht8305_get_humidity(void){