Jens Schneider / SI114x

Files at this revision

API Documentation at this revision

Comitter:
jenschn
Date:
Tue Jan 12 16:44:19 2016 +0000
Parent:
3:8833ad83c6c6
Commit message:
auto mode still not working

Changed in this revision

SI114x.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8833ad83c6c6 -r f84f3a3708cb SI114x.cpp
--- a/SI114x.cpp	Tue Jan 12 16:15:51 2016 +0000
+++ b/SI114x.cpp	Tue Jan 12 16:44:19 2016 +0000
@@ -249,6 +249,7 @@
             if (!write8(REG_IRQ_STATUS, 0x01)) return false;
             if (!write_param(PARAM_CHLIST, VAL_EN_ALS_VIS | VAL_EN_ALS_IR | VAL_EN_UV)) return false;
             if (!command(CMD_ALS_FORCE)) return false;
+            wait_ms(250);
             do {
                 if (!read8(res,REG_IRQ_STATUS)) return false;
                 if ((res&0x1)!=0x1) wait_ms(5);
@@ -325,7 +326,6 @@
     }
     goto visdone; // no change
 visnext:
-    wait_ms(5);
     m_visrange = range_t(rev_code_tab[code][0]);
     m_visgain  = gain_t(rev_code_tab[code][1]);
     //ser.printf("VIS param: %s, gain=%i norm=%f\r\n",m_visrange==RANGE_HIGH ? "Hi" : "Lo",uint8_t(m_visgain),m_vis_norm);
@@ -353,7 +353,6 @@
     }
     goto irdone; // no change
 irnext:
-    wait_ms(5);
     m_irrange = range_t(rev_code_tab[code][0]);
     m_irgain  = gain_t(rev_code_tab[code][1]);
     //ser.printf("IR param: %s, gain=%i norm=%f\r\n",m_irrange==RANGE_HIGH ? "Hi" : "Lo",uint8_t(m_irgain),m_ir_norm);
@@ -556,6 +555,7 @@
     if (!burst_write(REG_PARAM_WR,buf,2)) return false;
     do {
         if (!read8(retval,REG_RESPONSE)) return false;
+        if (res==retval) wait_ms(1);
     } while(res==retval);
     if (response) *response = retval;
     return true;