Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CRC16 FreescaleIAP FreescaleWatchdog GGSProtocol LM75B PIMA Parameters PersistentCircularQueue SerialNumberV2COM mbed-dev-watchdog_2016_03_04
Fork of smartRamalKW by
mm.cpp
00001 #include "appCommands.h" 00002 #include "sensor.h" 00003 #include "memoriaMassa.h" 00004 00005 #define MM_FALHA 1 00006 #define MM_FIM 2 00007 00008 extern MemoriaMassa mm; 00009 char* respMM[3]; 00010 00011 void cmdMemoriaMassa(int channel, int block){ 00012 int ch; 00013 switch(channel){ 00014 case 0: // Tensao de Carga 00015 ch = APP_PARAMETERS.LOAD_CHANNEL; 00016 break; 00017 case 1: // Tensao de Linha 00018 ch = APP_PARAMETERS.LOAD_CHANNEL == 0 ? 1 : 0; 00019 break; 00020 case 2: // Corrente 00021 ch = 2; 00022 break; 00023 } 00024 00025 if(block == 0){ 00026 free(respMM[ch]); 00027 respMM[ch] = mm.getMM(ch); 00028 } 00029 00030 if(respMM[ch] == NULL){ 00031 exec.enviaResposta(RESP_MEMORIA_MASSA, MM_FALHA); 00032 } else{ 00033 int mmSize = APP_PARAMETERS.MM_SIZE; 00034 if(mmSize < 0 || mmSize > 127){ 00035 mmSize = 100; // Use default 00036 } 00037 int blocks = ceil(mmSize / 25.0); 00038 if(blocks < 0 || blocks > 6){ 00039 blocks = 4; // Use default of 100 entries 00040 } 00041 if(block >= blocks){ 00042 exec.enviaResposta(RESP_MEMORIA_MASSA, MM_FIM); 00043 free(respMM[ch]); 00044 } else{ 00045 int size = 8*25; 00046 if(block == blocks-1){ 00047 size = 8*(APP_PARAMETERS.MM_SIZE % 25); 00048 if(size == 0){ 00049 size = 8*25; 00050 } 00051 } 00052 exec.enviaResposta(RESP_MEMORIA_MASSA, respMM[ch]+block*8*25, size); 00053 } 00054 } 00055 }
Generated on Thu Jul 14 2022 00:24:57 by
1.7.2
