本文整理汇总了C++中print_P函数的典型用法代码示例。如果您正苦于以下问题:C++ print_P函数的具体用法?C++ print_P怎么用?C++ print_P使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_P函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_P
// Send control constants as JSON string. Might contain spaces between minus sign and number. Python will have to strip these
void PiLink::sendControlConstants(void){
char tempString[12];
print_P(PSTR("C:{"));
sendJsonPair(jsonKeys.tempFormat, tempControl.cc.tempFormat);
sendJsonPair(jsonKeys.tempSettingMin, tempToString(tempString, tempControl.cc.tempSettingMin, 1, 12));
sendJsonPair(jsonKeys.tempSettingMax, tempToString(tempString, tempControl.cc.tempSettingMax, 1, 12));
sendJsonPair(jsonKeys.KpHeat, fixedPointToString(tempString, tempControl.cc.KpHeat, 3, 12));
sendJsonPair(jsonKeys.KpCool, fixedPointToString(tempString, tempControl.cc.KpCool, 3, 12));
sendJsonPair(jsonKeys.Ki, fixedPointToString(tempString, tempControl.cc.Ki, 3, 12));
sendJsonPair(jsonKeys.KdCool, fixedPointToString(tempString, tempControl.cc.KdCool, 3, 12));
sendJsonPair(jsonKeys.KdHeat, fixedPointToString(tempString, tempControl.cc.KdHeat, 3, 12));
sendJsonPair(jsonKeys.iMaxError, tempDiffToString(tempString, tempControl.cc.iMaxError, 3, 12));
sendJsonPair(jsonKeys.iMaxSlope, tempDiffToString(tempString, tempControl.cc.iMaxSlope, 3, 12));
sendJsonPair(jsonKeys.iMinSlope, tempDiffToString(tempString, tempControl.cc.iMinSlope, 3, 12));
sendJsonPair(jsonKeys.idleRangeHigh, tempDiffToString(tempString, tempControl.cc.idleRangeHigh, 3, 12));
sendJsonPair(jsonKeys.idleRangeLow, tempDiffToString(tempString, tempControl.cc.idleRangeLow, 3, 12));
sendJsonPair(jsonKeys.heatingTargetUpper, tempDiffToString(tempString, tempControl.cc.heatingTargetUpper, 3, 12));
sendJsonPair(jsonKeys.heatingTargetLower, tempDiffToString(tempString, tempControl.cc.heatingTargetLower, 3, 12));
sendJsonPair(jsonKeys.coolingTargetUpper, tempDiffToString(tempString, tempControl.cc.coolingTargetUpper, 3, 12));
sendJsonPair(jsonKeys.coolingTargetLower, tempDiffToString(tempString, tempControl.cc.coolingTargetLower, 3, 12));
sendJsonPair(jsonKeys.maxHeatTimeForEstimate, tempControl.cc.maxHeatTimeForEstimate);
sendJsonPair(jsonKeys.maxCoolTimeForEstimate, tempControl.cc.maxCoolTimeForEstimate);
sendJsonPair(jsonKeys.fridgeFastFilter, tempControl.cc.fridgeFastFilter);
sendJsonPair(jsonKeys.fridgeSlowFilter, tempControl.cc.fridgeSlowFilter);
sendJsonPair(jsonKeys.fridgeSlopeFilter, tempControl.cc.fridgeSlopeFilter);
sendJsonPair(jsonKeys.beerFastFilter, tempControl.cc.beerFastFilter);
sendJsonPair(jsonKeys.beerSlowFilter, tempControl.cc.beerSlowFilter);
// last one 'manually' to have no trailing comma
print_P(PSTR("\"%s\":%u}\n"), jsonKeys.beerSlopeFilter, tempControl.cc.beerSlopeFilter);
}
示例2: print_racines
/**
*Affiche les racines de P
*/
void print_racines(mpz_t *P, int deg_P, mpz_t mod){
int i, nb_racines=0;
mpz_t rac[deg_P+1];
for(i=0; i<deg_P+1; i++){
mpz_init_set_str(rac[i], "-1", 10);
}
printf("\n\nEtude du Polynome : ");
print_P(P, deg_P);
racines(rac, P, deg_P,&nb_racines, mod);
for(i=0; i<deg_P+1; i++){
if (!mpz_cmp_si(rac[i],-1)){
printf("Polynome : ");
print_P(P, deg_P);
printf("%d racine(s)\n", nb_racines);
return;
}
printf("%ld est racine\n", mpz_get_si(rac[i]));
}
printf("Polynome : ");
print_P(P, deg_P);
printf("%d racines\n", nb_racines);
}
示例3: testEnd
//------------------------------------------------------------------------------
void testEnd() {
testOut->println();
println_P(testOut, PSTR("Compiled: " __DATE__ " " __TIME__));
print_P(testOut, PSTR("FreeRam: "));
testOut->println(FreeRam());
print_P(testOut, PSTR("Test count: "));
testOut->println(testCount);
print_P(testOut, PSTR("Fail count: "));
testOut->println(failCount);
}
示例4: print_P
size_t RedFlyServer::println_P(PGM_P s)
{
size_t len;
len = print_P(s);
if(len)
{
len += print_P(PSTR("\r\n"));
}
return len;
}
示例5: print
// private
int8_t RogueSD::_open(int8_t handle, const char *path, openMode mode, int8_t pgmspc)
{
int8_t resp;
print(_prefix);
print('O');
print((char)('0' + handle));
print(' ');
switch (mode)
{
case OPEN_READ:
case OPEN_RW:
print('R');
if (mode == OPEN_READ) break;
case OPEN_WRITE:
print('W');
break;
case OPEN_APPEND:
print('A');
break;
}
print(' ');
if (pgmspc)
print_P(path);
else
print(path);
print('\r');
resp = _getResponse();
return resp ? handle : 0;
}
示例6: print
// private
int8_t RogueSD::_open(int8_t handle, const char *filename, open_mode mode, int8_t pgmspc)
{
int8_t resp;
if (_moduletype != uMMC) { print("FC"); };
print('O'); write('0'+handle); print(' ');
switch (mode)
{
case OPEN_READ:
case OPEN_RW:
print('R');
if (mode == OPEN_READ) break;
case OPEN_WRITE:
print('W');
break;
case OPEN_APPEND:
print('A');
break;
}
print(' ');
if (pgmspc)
print_P(filename);
else
print(filename);
print('\r');
resp = _get_response();
return resp < 0 ? resp : handle;
}
示例7: div_aux
void div_aux(mpz_t *res_int, mpz_t *P, mpz_t *Q, int deg_P, int deg_Q, mpz_t mod){
printf("entree dans div_aux\n");
int i;
mpz_t inverse, S[deg_P+1];
mpz_init(inverse);
for(i=0; i<deg_P+1; i++){
mpz_init(S[i]);
}
printf("fin init S\n");
inverse_modulaire(inverse, Q[0], mod);
/* de deg_Q a deg_P, les coeffs sont a 0 */
for(i=0; i<=deg_Q; i++){
mpz_set(S[i], inverse);
mpz_mul(S[i], Q[i], S[i]);
mpz_mod(S[i], S[i], mod);
mpz_mul(S[i], S[i], P[0]);
mpz_mod(S[i], S[i], mod);
}
print_P(S, deg_P);
printf("fin remplissage S\n");
/* On remplit res_int */
for(i=1; i<deg_P+1; i++){
mpz_sub(res_int[i], P[i], S[i]);
mpz_mod(res_int[i], res_int[i], mod);
}
printf("fin remplissage res_int\n");
}
示例8: outputCsv
static void outputCsv(void)
{
#ifdef HEATERMETER_SERIAL
print_P(PSTR("HMSU" CSV_DELIMITER));
pid.status();
Serial_nl();
#endif /* HEATERMETER_SERIAL */
}
示例9: reportLidParameters
static void reportLidParameters(void)
{
print_P(PSTR("HMLD" CSV_DELIMITER));
SerialX.print(pid.LidOpenOffset, DEC);
Serial_csv();
SerialX.print(pid.getLidOpenDuration(), DEC);
Serial_nl();
}
示例10: switch
void PiLink::receive(void){
if (Serial.available() > 0){
char inByte = Serial.read();
switch(inByte){
case 't': // temperatures requested
printTemperatures();
break;
case 'C': // Set default constants
tempControl.loadDefaultConstants();
display.printStationaryText(); // reprint stationary text to update to right degree unit
sendControlConstants(); // update script with new settings
debugMessage(PSTR("Default constants loaded."));
break;
case 'S': // Set default settings
tempControl.loadDefaultSettings();
sendControlSettings(); // update script with new settings
debugMessage(PSTR("Default settings loaded."));
break;
case 's': // Control settings requested
sendControlSettings();
break;
case 'c': // Control constants requested
sendControlConstants();
break;
case 'v': // Control variables requested
sendControlVariables();
break;
case 'l': // Display content requested
print_P(PSTR("L:"));
char stringBuffer[21];
for(uint8_t i=0;i<4;i++){
display.lcd.getLine(i, stringBuffer);
print_P(PSTR("%s<BR>"), stringBuffer);
}
print_P(PSTR("\n"));
break;
case 'j': // Receive settings as json
receiveJson();
break;
default:
debugMessage(PSTR("Invalid command Received by Arduino: %c"), inByte);
}
//Serial.flush(); Messages can be back to back. Flush should not be necessary.
// Functions should not read more than what is meant for that function.
}
}
示例11: print_P
void SerialUI::showFreeRAM()
{
extern int __heap_start, *__brkval;
int v;
print_P(PSTR("Free RAM: "));
println(freeRAM());
}
示例12: printJsonSeparator
void PiLink::printJsonName(const char * name)
{
printJsonSeparator();
piStream.print('"');
print_P(name);
piStream.print('"');
piStream.print(':');
}
示例13: testVerify_P
//------------------------------------------------------------------------------
void testVerify_P(char* result, PGM_P expect) {
testOut->write('"');
testOut->print(result);
testOut->print("\",\"");
print_P(testOut, expect);
testOut->write('"');
uint8_t n = strlen(result) + strlen_P(expect) + 5;
testResult(!strcmp_P(result, expect), n);
}
示例14: print_P
void SerialOutput::printFloat(double number, uint8_t digits)
{
if (isnan(number)) {
print_P(PSTR("NAN"));
return;
}
if (isinf(number)) {
print_P(PSTR("INF"));
return;
}
// Handle negative numbers
if (number < 0.0)
{
write('-');
number = -number;
}
// Round correctly so that print(1.999, 2) prints as "2.00"
double rounding = 0.5;
for (uint8_t i=0; i<digits; ++i)
rounding /= 10.0;
number += rounding;
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part;
print(int_part);
// Print the decimal point, but only if there are digits beyond
if (digits > 0)
write('.');
// Extract digits from the remainder one at a time
while (digits-- > 0)
{
remainder *= 10.0;
int toPrint = int(remainder);
print(toPrint);
remainder -= toPrint;
}
}
示例15: set_device
bool
Trace::begin(IOStream::Device* dev, const char* banner)
{
set_device(dev);
if (banner != NULL) {
print_P(banner);
println();
}
return (true);
}