From 2fb9d69b6148292da43528660cb633d67b751ef4 Mon Sep 17 00:00:00 2001 From: MReenen Date: Thu, 28 Jan 2021 11:35:42 +0100 Subject: [PATCH] add fomulas for power masurment --- src/MPPT.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MPPT.c b/src/MPPT.c index 516c518..a786240 100644 --- a/src/MPPT.c +++ b/src/MPPT.c @@ -27,10 +27,10 @@ uint8_t mppt_getVermogen(){ } void mppt_meetVermogen(){ - uint16_t spanning = ADC_read(ADC_CH2); - uint16_t curent = ADC_read(ADC_CH3); - //TODO: add real formula for spanning and curent - mppt_vermogen = (spanning * curent) / 100; + uint32_t spanning = ADC_read(ADC_CH2) * 1000 / 56; // milivolt + uint32_t curent = (ADC_read(ADC_CH3)-13) * 1000 / 173; // miliampere + + mppt_vermogen = (spanning * curent) / 10000; // deciwatt noodstop_vermogen(mppt_vermogen); }