balbekova 7 лет назад
Родитель
Сommit
1bb9a91442
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      modules/MegaTec/megatec.c

+ 4 - 4
modules/MegaTec/megatec.c

@@ -102,13 +102,13 @@ void send_MegaTec_cmd(cmdMegaTecEnums_t command)
 		memset(req, 0, 10);
 		if(TimeParamFloat >= 1 && TimeParamFloat < 10)
 		{
-			sprintf(req, "%s0%f\r", MegaTecCMD[command], TimeParamFloat);
+			sprintf(req, "%s0%d\r", MegaTecCMD[command], (uint16_t)TimeParamFloat);
 		}
 		else if(TimeParamFloat < 1){
-			sprintf(req, "%s.%f\r", MegaTecCMD[command], 10*TimeParamFloat);
+			sprintf(req, "%s.%d\r", MegaTecCMD[command], (uint16_t)(10*TimeParamFloat));
 		}
 		else{
-			sprintf(req, "%s%f\r", MegaTecCMD[command], TimeParamFloat);
+			sprintf(req, "%s%d\r", MegaTecCMD[command], (uint16_t)TimeParamFloat);
 		}
 		ups_send_block(req, strlen(req));
 	}
@@ -355,7 +355,7 @@ int ups_metac_service_pdu(cmdMegaTecEnums_t command)
 			megatec_send = true;
 			if(strncmp(ups_pdu.data, "ACK", 3) == 0)
 				return 1;
-			else if(strncmp(ups_pdu.data, "NCK", 3) == 0)
+			else if(strncmp(ups_pdu.data, "NAK", 3) == 0)
 				return 0;
 
 		}