[Fw] Delete ambient-light in code because new hardware deprecated this sensor.

This commit is contained in:
稚晖 2021-03-01 16:56:24 +08:00
parent 1ff20c595b
commit ea1cc5ead9

View File

@ -15,11 +15,10 @@
Display screen;
IMU mpu;
Pixel rgb;
Ambient ambLight;
SdCard tf;
Network wifi;
//Ambient ambLight;
long time1;
void setup()
{
@ -37,9 +36,6 @@ void setup()
rgb.init();
rgb.setBrightness(0.1).setRGB(0, 0, 122, 204).setRGB(1, 0, 122, 204);
/*** Init ambient-light sensor ***/
ambLight.init(ONE_TIME_H_RESOLUTION_MODE);
/*** Init micro SD-Card ***/
tf.init();
lv_fs_if_init();
@ -47,6 +43,8 @@ void setup()
String ssid = tf.readFileLine("/wifi.txt", 1); // line-1 for WiFi ssid
String password = tf.readFileLine("/wifi.txt", 2); // line-2 for WiFi password
/*** Init ambient-light sensor ***/
//ambLight.init(ONE_TIME_H_RESOLUTION_MODE);
/*** Inflate GUI objects ***/
//lv_demo_benchmark();
@ -54,7 +52,7 @@ void setup()
//tf.readBinFromSd("/ali.bin", (uint8_t*)screen_buffer.data);
//tf.writeBinToSd("/ali.bin", (uint8_t*)screen_buffer.data + 64);
lv_holo_cubic_gui();
lv_scr_load_anim(scr2, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 3000, false);
//lv_scr_load_anim(scr2, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 3000, false);
/*** Read WiFi info from SD-Card, then scan & connect WiFi ***/
@ -64,47 +62,16 @@ void setup()
// Change to your BiliBili UID ¡ý
Serial.println(wifi.getBilibiliFans("20259914"));
#endif
/*tf.listDir("/", 0);
tf.createDir("/mydir");
tf.listDir("/", 0);
tf.removeDir("/mydir");
tf.listDir("/", 2);
tf.writeFile("/hello.txt", "Hello ");
tf.appendFile("/hello.txt", "World!\n");
tf.readFile("/hello.txt");
tf.deleteFile("/foo.txt");
tf.renameFile("/hello.txt", "/foo.txt");
tf.readFile("/foo.txt");
tf.fileIO("/test.txt");
Serial.printf("Total space: %lluMB\n", SD.totalBytes() / (1024 * 1024));
Serial.printf("Used space: %lluMB\n", SD.usedBytes() / (1024 * 1024));*/
//Serial.println(sizeof(screen_buffer));
time1 = millis();
}
int flag = 0;
void loop()
{
// run this as often as possible ¡ý
screen.routine();
// 200 means update IMU data every 200ms
mpu.update(200);
rgb.setBrightness(ambLight.getLux() / 500.0);
//Serial.println(ambLight.getLux());
delay(10);
if (millis() - time1 > 6000 && !flag)
{
flag = 1;
lv_scr_load_anim(scr1, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0, false);
}
}