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

Committer:
tpadovani
Date:
Mon Oct 19 20:34:15 2015 +0000
Revision:
22:b66e36356dd4
Parent:
20:da03c9e94ad3
debug condicional

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tpadovani 5:1bc98277c257 1 #include "appCommands.h"
tpadovani 5:1bc98277c257 2
tpadovani 5:1bc98277c257 3 #define SUCESSO 0
tpadovani 5:1bc98277c257 4 #define TAMANHO_INVALIDO 0xff
tpadovani 5:1bc98277c257 5 #define ERRO_GRAVACAO 0xfe
tpadovani 5:1bc98277c257 6
tpadovani 10:7a1d1abb5172 7 void cmdConfigurarParametros(char * dados, unsigned char tamanhoDados){
tpadovani 5:1bc98277c257 8
tpadovani 5:1bc98277c257 9 if(tamanhoDados != sizeof(APP_PARAMETERS)){
tpadovani 5:1bc98277c257 10 exec.enviaResposta(RESP_CONFIGURAR_PARAMETROS, (char)TAMANHO_INVALIDO);
tpadovani 5:1bc98277c257 11 return;
tpadovani 5:1bc98277c257 12 }
tpadovani 5:1bc98277c257 13
tpadovani 11:8c93e0de58cd 14 // Totalizador de ciclos de corte/religa nao deve ser alterado
tpadovani 11:8c93e0de58cd 15 unsigned int totalizador = APP_PARAMETERS.contadorCiclos;
tpadovani 10:7a1d1abb5172 16 memcpy((char *)&APP_PARAMETERS, dados, sizeof(APP_PARAMETERS));
tpadovani 11:8c93e0de58cd 17 APP_PARAMETERS.contadorCiclos = totalizador;
tpadovani 5:1bc98277c257 18
tpadovani 5:1bc98277c257 19 if(!param.saveParameters()){
tpadovani 22:b66e36356dd4 20 DEBUG(printf("[GGS] Error writing parameters\r\n"));
tpadovani 5:1bc98277c257 21 exec.enviaResposta(RESP_CONFIGURAR_PARAMETROS, (char)ERRO_GRAVACAO);
tpadovani 5:1bc98277c257 22 return;
tpadovani 5:1bc98277c257 23 }
tpadovani 5:1bc98277c257 24 exec.enviaResposta(RESP_CONFIGURAR_PARAMETROS, SUCESSO);
tpadovani 5:1bc98277c257 25 softReset();
tpadovani 5:1bc98277c257 26 }