Frederico Prado / smartRamalEZR

Dependencies:   CRC16 FreescaleIAP FreescaleWatchdog GGSProtocol LM75B PIMA Parameters PersistentCircularQueue SerialNumberV2COM mbed-dev-watchdog_2016_03_04

Fork of smartRamalKW by Equipe Firmware V2COM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers grandezaInstantanea.cpp Source File

grandezaInstantanea.cpp

00001 #include "appCommands.h"
00002 #include "sensor.h"
00003 
00004 void cmdGrandezaInstantanea(int channel){
00005     union{
00006         float measure;
00007         char bytes[4];
00008     } resp;
00009     
00010     switch(channel){
00011         case 0: // Tensao de Carga
00012         {
00013             int lineChannel = APP_PARAMETERS.LOAD_CHANNEL == 0 ? 1 : 0;
00014             float line = getInstVoltage(lineChannel);
00015             resp.measure = line - getInstVoltage(APP_PARAMETERS.LOAD_CHANNEL);
00016             break;
00017         }
00018         case 1: // Tensao de Linha
00019             resp.measure = getInstVoltage(APP_PARAMETERS.LOAD_CHANNEL == 0 ? 1 : 0);
00020             break;
00021         case 2: // Corrente
00022             resp.measure = getInstCurrent();
00023             break;
00024     }
00025 
00026     exec.enviaResposta(RESP_GRANDEZA_INSTANTANEA, resp.bytes, 4);
00027 }