some fixes of old bugs

This commit is contained in:
2025-02-05 17:49:07 +03:00
parent a22776d487
commit 6eb0662f69
28 changed files with 1467 additions and 566 deletions

View File

@@ -126,9 +126,11 @@ uint16_t getADCval(int nch){
PIX_SORT(p[4], p[2]) ;
#undef PIX_SORT
#undef PIX_SWAP
/*
#ifdef EBUG
DBG("val: "); printu(p[4]); newline();
#endif
*/
return p[4];
}
@@ -136,9 +138,11 @@ uint16_t getADCval(int nch){
int32_t getADCvoltage(int nch){
float v = getADCval(nch) * 3.3;
v /= 4.096f; // 12bit ADC
/*
#ifdef EBUG
DBG("v="); printf(v); newline();
#endif
*/
return (uint32_t) v;
}
@@ -150,9 +154,11 @@ int32_t getMCUtemp(){
temperature *= (110.f - 30.f);
temperature /= (float)(*TEMP30_CAL_ADDR - *TEMP110_CAL_ADDR);
temperature += 30.f;
/*
#ifdef EBUG
DBG("t="); printf(temperature); newline();
#endif
*/
return (uint32_t) (temperature*1000.f);
}
@@ -160,8 +166,10 @@ int32_t getMCUtemp(){
int32_t getVdd(){
float vdd = ((float) *VREFINT_CAL_ADDR) * 3.3f; // 3.3V
vdd /= getADCval(ADC_VREF);
/*
#ifdef EBUG
DBG("vdd="); printf(vdd); newline();
#endif
*/
return (uint32_t) (vdd * 1000.f);
}