Erreur compilation "too few arguments to function"

Bonjour,

Lorsque je compile ce code, celui-ci m'indique une erreur de type "too few arguments to function 'int intround(const float&)'" Je ne vois pas pourquoi car je l'ai déclaré qu'une seule fois. Pouvez-vous m'expliquer d'où peut venir cet erreur?
Merci.

#include "lcd4d.h"

static char messagetext[LCD4D_WIDTH]="";

boolean force_lcd_update=false;

//return for string conversion routines
static char conv[8];

#define BUFFLEN 30
static char cmd_buff[BUFFLEN];
static int  buff_index=0;

static unsigned long previous_millis_lcd=0;

#define degHotend0()// degHotend(0)
static int olddegHotEnd0=0;
static int oldtargetHotEnd0=0;

void setup() {
  // put your setup code here, to run once:
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
//lcd4d_init();
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
if(Serial.available()>0)
  {
    char letter = Serial.read();
    Serial.println(letter);
    if(letter == '1')
    {
      digitalWrite(13,HIGH);
      Serial.println("The LED is ON");
    }
    else if (letter == '0')
    {
      digitalWrite(13,LOW);
      Serial.println("The LED is OFF");
    }
   }
}

int intround (const float &x)
{
           return int(0.5+x);
}

void lcd4d_incoming()
{
while(MYSERIAL1.available()>0)
{

  cmd_buff[buff_index]= (char) MYSERIAL1.read();
  Serial.println(Serial.read());      
Serial.println(cmd_buff[buff_index]);
    
    
  if (cmd_buff[buff_index]=='\n')
  {
    cmd_buff[buff_index]= 0;
//  parsecmd(cmd_buff,buff_index);

    buff_index = 0;
  } else
   buff_index++;

    if(buff_index >= BUFFLEN)
    {
      buff_index = BUFFLEN-1;
    }
}
}

void lcd4d_force_update()
{
  force_lcd_update=true;
}

void lcd4d_status(const char* message)
{
  strncpy(messagetext,message,LCD4D_WIDTH);
  messagetext[strlen(message)]=0;
}


void lcd4d_statuspgm(const char* message)
{
  char ch=pgm_read_byte(message);
  char *target=messagetext;
  uint8_t cnt=0;
  while(ch &&cnt<LCD4D_WIDTH)
  {
    *target=ch;
    target++;
    cnt++;
    ch=pgm_read_byte(++message);
  }
  *target=0;
}

void lcd4d_status()
{
    if(!force_lcd_update)
      if((millis() - previous_millis_lcd) < LCD4D_UPDATE_INTERVAL)
        return;
     
     lcd4d_update();
     previous_millis_lcd=millis();
}

void lcd4d_init()
{
   MYSERIAL1.begin(115200);
   SERIAL1_PROTOCOLPGM(MESSAGE_ID)
   SERIAL1_PROTOCOLLNPGM(WELCOME_MSG)

}


void lcd4d_update() {
  lcd4d_showStatus();
}

void zeroFill(int value) 
{
  if(value < 100)
     SERIAL1_PROTOCOLPGM("0");
   if(value < 10)
     SERIAL1_PROTOCOLPGM("0");
}

void lcd4d_showStatus()
{ 
  //HotEnd0  
  int tHotEnd0=intround (degHotend0());
  
  if(tHotEnd0!=olddegHotEnd0 || force_lcd_update)
  {
    SERIAL1_PROTOCOLPGM(HOTEND0_ID)
    zeroFill(tHotEnd0);
    SERIAL1_PROTOCOLLN(tHotEnd0)
    olddegHotEnd0=tHotEnd0;
  }
  int ttHotEnd0=intround(degTargetHotend0());
  if(ttHotEnd0!=oldtargetHotEnd0 || force_lcd_update)
  {
    SERIAL1_PROTOCOLPGM(THOTEND0_ID)
    if(ttHotEnd0==-272) // First time, force update
    {
       SERIAL1_PROTOCOLLN("000")
       oldtargetHotEnd0=0;     
    }
    else
    {
    zeroFill(ttHotEnd0);
    SERIAL1_PROTOCOLLN(ttHotEnd0)
    oldtargetHotEnd0=ttHotEnd0;
    }
  }
}

 //  convert float to string with +123.4 format
char *ftostr3(const float &x)
{
  //sprintf(conv,"%5.1f",x);
  int xx=x;
  conv[0]=(xx/100)%10+'0';
  conv[1]=(xx/10)%10+'0';
  conv[2]=(xx)%10+'0';
  conv[3]=0;
  return conv;
}

char *itostr2(const uint8_t &x)
{
  //sprintf(conv,"%5.1f",x);
  int xx=x;
  conv[0]=(xx/10)%10+'0';
  conv[1]=(xx)%10+'0';
  conv[2]=0;
  return conv;
}

//  convert float to string with +123.4 format
char *ftostr31(const float &x)
{
  int xx=x*10;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/1000)%10+'0';
  conv[2]=(xx/100)%10+'0';
  conv[3]=(xx/10)%10+'0';
  conv[4]='.';
  conv[5]=(xx)%10+'0';
  conv[6]=0;
  return conv;
}

char *ftostr32(const float &x)
{
  int xx=x*100;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/100)%10+'0';
  conv[2]='.';
  conv[3]=(xx/10)%10+'0';
  conv[4]=(xx)%10+'0';
  conv[6]=0;
  return conv;
}

char *itostr31(const int &xx)
{
  conv[0]=(xx>=0)?'+':'-';
  conv[1]=(xx/1000)%10+'0';
  conv[2]=(xx/100)%10+'0';
  conv[3]=(xx/10)%10+'0';
  conv[4]='.';
  conv[5]=(xx)%10+'0';
  conv[6]=0;
  return conv;
}

char *itostr3(const int &xx)
{
  conv[0]=(xx/100)%10+'0';
  conv[1]=(xx/10)%10+'0';
  conv[2]=(xx)%10+'0';
  conv[3]=0;
  return conv;
}

char *itostr4(const int &xx)
{
  conv[0]=(xx/1000)%10+'0';
  conv[1]=(xx/100)%10+'0';
  conv[2]=(xx/10)%10+'0';
  conv[3]=(xx)%10+'0';
  conv[4]=0;
  return conv;
}

//  convert float to string with +1234.5 format
char *ftostr51(const float &x)
{
  int xx=x*10;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/10000)%10+'0';
  conv[2]=(xx/1000)%10+'0';
  conv[3]=(xx/100)%10+'0';
  conv[4]=(xx/10)%10+'0';
  conv[5]='.';
  conv[6]=(xx)%10+'0';
  conv[7]=0;
  return conv;
}

//  convert float to string with +123.45 format
char *ftostr52(const float &x)
{
  int xx=x*100;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/10000)%10+'0';
  conv[2]=(xx/1000)%10+'0';
  conv[3]=(xx/100)%10+'0';
  conv[4]='.';
  conv[5]=(xx/10)%10+'0';
  conv[6]=(xx)%10+'0';
  conv[7]=0;
  return conv;
}

Le code pour l'inclusion lcd4d

#define LCD4D_WIDTH 57
#define LCD4D_UPDATE_INTERVAL 100

#define MESSAGE_ID "M:"
#define HOTEND0_ID "H0:"
#define HOTEND1_ID "H1:"
#define THOTEND0_ID "T0:"
#define THOTEND1_ID "T1:"
#define TBED_ID "B:"
#define TTBED_ID "TB:"
#define TIME_ID "t:"
#define ZPOS_ID "Z:"
#define SDPERCENT_ID "S:"
#define FEEDMULTIPLY_ID "F:"
#define SOUND_ID "s:"

#define LCD4D_CHECKDATA lcd4d_incoming();
#define LCD_FORCE_UPDATE lcd4d_force_update();

#define WELCOME_MSG "CNC Ready."

#define MYSERIAL1 Serial1

#define MYPGM(s) PSTR(s)
#define SERIAL1_PROTOCOL(x) MYSERIAL1.print(x);
#define SERIAL1_PROTOCOL_F(x,y) MYSERIAL1.print(x,y);
#define SERIAL1_PROTOCOLPGM(x) serial1printPGM(MYPGM(x));
#define SERIAL1_PROTOCOLLN(x) {MYSERIAL1.print(x);MYSERIAL1.write('\n');}
#define SERIAL1_PROTOCOLLNPGM(x) {serial1printPGM(MYPGM(x));MYSERIAL1.write('\n');}

const char errormagic[] PROGMEM ="Error:";
const char echomagic[] PROGMEM ="echo:";

#define SERIAL1_ERROR_START serial1printPGM(errormagic);
#define SERIAL1_ERROR(x) SERIAL1_PROTOCOL(x)
#define SERIAL1_ERRORPGM(x) SERIAL1_PROTOCOLPGM(x)
#define SERIAL1_ERRORLN(x) SERIAL1_PROTOCOLLN(x)
#define SERIAL1_ERRORLNPGM(x) SERIAL1_PROTOCOLLNPGM(x)

#define SERIAL1_ECHO_START serial1printPGM(echomagic);
#define SERIAL1_ECHO(x) SERIAL1_PROTOCOL(x)
#define SERIAL1_ECHOPGM(x) SERIAL1_PROTOCOLPGM(x)
#define SERIAL1_ECHOLN(x) SERIAL1_PROTOCOLLN(x)
#define SERIAL1_ECHOLNPGM(x) SERIAL1_PROTOCOLLNPGM(x)

#define Serial1printPGM(x) serial1printPGM(MYPGM(x))

#define  FORCE_INLINE __attribute__((always_inline)) inline

FORCE_INLINE void serial1printPGM(const char *str)
{
  char ch=pgm_read_byte(str);
  while(ch)
  {
    MYSERIAL1.write(ch);
    ch=pgm_read_byte(++str);
  }
}


/*void lcd4d_init();
void lcd4d_update();
void lcd4d_status();
void lcd4d_status(const char* message);
void lcd4d_status();
void lcd4d_statuspgm(const char* message);
void lcd4d_showStatus();
void lcd4d_finishSound();
void lcd4d_incoming();
void lcd4d_force_update();
*/

char *ftostr3(const float &x);
char *itostr2(const uint8_t &x);
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *itostr31(const int &xx);
char *itostr3(const int &xx);
char *itostr4(const int &xx);
char *ftostr51(const float &x);

Facile: "to few arguments to function int intround()".
On ne peut pas le dire mieux: la fonction demande un argument, qui n'est pas fourni lors de tes appel à ta fonction.

Ligne 139, tu passes degHotend0() en argument. Or, ligne 16, il y a une macro pré-processeur qui fait correspondre degHotend0() à... rien. Donc ça revient à appeler une fonction vide.

Ligne 148, tu passes en argument quelque chose qui n'est défini ni comme fonction, ni comme variable, ni comme macro pré-processeur, ni dans ton fichier, ni dans le fichier inclus. Je pense que lorsque tu auras réglé le problème du premier appel à la fonction, ce deuxième appel générera lui aussi une erreur.

:wink:

Tu définis une fonction

#define degHotend0()// degHotend(0)

mais est-ce qu'elle renvoie quelque chose ?

Cordialement.

Pierre

Merci beaucoup!! Ca compile!! :slight_smile:

#define degHotend0() degHotend(0)
[u]float degHotend (uint8_t extruder) {}[/u]

vince3011:
Ligne 148, tu passes en argument quelque chose qui n'est défini ni comme fonction, ni comme variable, ni comme macro pré-processeur, ni dans ton fichier, ni dans le fichier inclus. Je pense que lorsque tu auras réglé le problème du premier appel à la fonction, ce deuxième appel générera lui aussi une erreur.

J'avais pas tout copier le code. Désolé!

Maintenant j'ai un autre problème. Quand je compile, une erreur "Error compiling for board Arduino/Genuino Mega or Mega 2560." >:( >:( >:(

Alors là!! Je ne vois pas où est le problème.

#include "lcd4d.h"
#define LCD_4D

#define MYSERIAL1 Serial1

static char messagetext[LCD4D_WIDTH]="";

boolean force_lcd_update=false;

//return for string conversion routines
static char conv[8];

#define BUFFLEN 30
static char cmd_buff[BUFFLEN];
static int  buff_index=0;

static unsigned long previous_millis_lcd=0;

static int olddegHotEnd0=0;
static int oldtargetHotEnd0=0;

static uint16_t oldtime_m=10;
static uint16_t oldtime_h=2;
static int oldzpos=0;
static int oldfeedmultiply=0;

#define NUM_AXIS 4
float current_position[NUM_AXIS] = { 0.0, 0.0, 2.1, 0.0 };
enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3};

extern volatile int feedmultiply;
extern volatile bool feedmultiplychanged;

extern volatile int extrudemultiply;

volatile int feedmultiply=100;
int curfeedmultiply=feedmultiply;

static unsigned long starttime=0;
static unsigned long stoptime=0;
  
#define degHotend0() degHotend(0)
float degHotend (uint8_t extruder) {}

#define degTargetHotend0() degTargetHotend(0)
float degTargetHotend(uint8_t extruder) {}


void setup() {
 
Serial.println("Reset");
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
Serial.begin(9600);
}

void loop() {
 
#ifdef LCD_4D

lcd4d_init();
lcd4d_update();
lcd4d_status();
//lcd4d_status(const char* message);
lcd4d_status();
//lcd4d_statuspgm(const char* message);
lcd4d_showStatus();
lcd4d_finishSound();
lcd4d_incoming();
lcd4d_force_update();
#endif

if(Serial.available()>0)
  {
    char letter = Serial.read();
    Serial.println(letter);
    if(letter == '1')
    {
      digitalWrite(13,HIGH);
      Serial.println("The LED is ON");
    }
    else if (letter == '0')
    {
      digitalWrite(13,LOW);
      Serial.println("The LED is OFF");
    }
   }
}

int intround (const float &x){return int(0.5+x);}

void lcd4d_incoming() //Serial event
{
  Serial.println("okdac");
while(MYSERIAL1.available()>0)
{
  cmd_buff[buff_index]= (char) MYSERIAL1.read();
   Serial.println(cmd_buff[buff_index]);
  if (cmd_buff[buff_index]=='\n')
  {
    cmd_buff[buff_index]= 0;

    buff_index = 0;
  } else
   buff_index++;

    if(buff_index >= BUFFLEN)
    {
      buff_index = BUFFLEN-1;
    }
}
}

void lcd4d_force_update()
{
  force_lcd_update=true;
}

void lcd4d_status(const char* message)
{
  strncpy(messagetext,message,LCD4D_WIDTH);
  messagetext[strlen(message)]=0;
}


void lcd4d_statuspgm(const char* message)
{
  char ch=pgm_read_byte(message);
  char *target=messagetext;
  uint8_t cnt=0;
  while(ch &&cnt<LCD4D_WIDTH)
  {
    *target=ch;
    target++;
    cnt++;
    ch=pgm_read_byte(++message);
  }
  *target=0;
}

void lcd4d_status()
{
    if(!force_lcd_update)
      if((millis() - previous_millis_lcd) < LCD4D_UPDATE_INTERVAL)
        return;
     lcd4d_update();
     previous_millis_lcd=millis();
}

void lcd4d_init()
{
   Serial1.begin(115200);
   Serial.println("ici");
   SERIAL1_PROTOCOLPGM(MESSAGE_ID)
   SERIAL1_PROTOCOLLNPGM(WELCOME_MSG)

}

void lcd4d_update() {
  lcd4d_showStatus();
}

void zeroFill(int value) 
{
  if(value < 100)
     SERIAL1_PROTOCOLPGM("0");
   if(value < 10)
     SERIAL1_PROTOCOLPGM("0");
}


void lcd4d_showStatus()
{ 
  //HotEnd0  
 int tHotEnd0= intround(degHotend0());
  if(tHotEnd0!=olddegHotEnd0 || force_lcd_update)
  {
    SERIAL1_PROTOCOLPGM(HOTEND0_ID)
    zeroFill(tHotEnd0);
    SERIAL1_PROTOCOLLN(tHotEnd0)
    olddegHotEnd0=tHotEnd0;
  }

    int ttHotEnd0=intround(degTargetHotend0());
  if(ttHotEnd0!=oldtargetHotEnd0 || force_lcd_update)
  {
    SERIAL1_PROTOCOLPGM(THOTEND0_ID)
    if(ttHotEnd0==-272) // First time, force update
    {
       SERIAL1_PROTOCOLLN("100")
       oldtargetHotEnd0=0;     
    }
    else
    {
    zeroFill(ttHotEnd0);
    SERIAL1_PROTOCOLLN(ttHotEnd0)
    oldtargetHotEnd0=ttHotEnd0;
    }
  }
 if(starttime!=0)
  {
    uint16_t time=millis()/60000-starttime/60000;
    
      uint16_t m=time%60;
      uint16_t h=time/60;
    
    if( ((time/60)!=oldtime_h || (time%60)!=oldtime_m ) || force_lcd_update )
    {
      SERIAL1_PROTOCOLPGM(TIME_ID)
      SERIAL1_PROTOCOL(itostr2(h))
      SERIAL1_PROTOCOLPGM("h");
      SERIAL1_PROTOCOL(itostr2(m))
      SERIAL1_PROTOCOLLNPGM("m");
      oldtime_h=h;
      oldtime_m=m;
    }
  }
  
  int currentz=current_position[Z_AXIS]*100;
  if(currentz!=oldzpos || force_lcd_update)
  {
    SERIAL1_PROTOCOLPGM(ZPOS_ID)
    SERIAL1_PROTOCOLLN(ftostr52(current_position[Z_AXIS]))
    oldzpos=currentz;
  }
  
  int curfeedmultiply=feedmultiply;
  
  if(feedmultiplychanged == true) {
    feedmultiplychanged = false;
  }
    
  if((curfeedmultiply!=oldfeedmultiply)||force_lcd_update)
  {
   oldfeedmultiply=curfeedmultiply;
   SERIAL1_PROTOCOLPGM(FEEDMULTIPLY_ID)
   SERIAL1_PROTOCOLLN(itostr3(curfeedmultiply));
  }  
  
  if(messagetext[0]!='\0')
  {
    SERIAL1_PROTOCOLPGM(MESSAGE_ID)
    SERIAL1_PROTOCOLLN(messagetext);
    messagetext[0]='\0';
  }
  
  force_lcd_update=false; 
}

void lcd4d_finishSound()
{
    SERIAL1_PROTOCOLLNPGM(SOUND_ID);
}
  
 //  convert float to string with +123.4 format
char *ftostr3(const float &x)
{
  //sprintf(conv,"%5.1f",x);
  int xx=x;
  conv[0]=(xx/100)%10+'0';
  conv[1]=(xx/10)%10+'0';
  conv[2]=(xx)%10+'0';
  conv[3]=0;
  return conv;
}

char *itostr2(const uint8_t &x)
{
  //sprintf(conv,"%5.1f",x);
  int xx=x;
  conv[0]=(xx/10)%10+'0';
  conv[1]=(xx)%10+'0';
  conv[2]=0;
  return conv;
}

//  convert float to string with +123.4 format
char *ftostr31(const float &x)
{
  int xx=x*10;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/1000)%10+'0';
  conv[2]=(xx/100)%10+'0';
  conv[3]=(xx/10)%10+'0';
  conv[4]='.';
  conv[5]=(xx)%10+'0';
  conv[6]=0;
  return conv;
}

char *ftostr32(const float &x)
{
  int xx=x*100;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/100)%10+'0';
  conv[2]='.';
  conv[3]=(xx/10)%10+'0';
  conv[4]=(xx)%10+'0';
  conv[6]=0;
  return conv;
}

char *itostr31(const int &xx)
{
  conv[0]=(xx>=0)?'+':'-';
  conv[1]=(xx/1000)%10+'0';
  conv[2]=(xx/100)%10+'0';
  conv[3]=(xx/10)%10+'0';
  conv[4]='.';
  conv[5]=(xx)%10+'0';
  conv[6]=0;
  return conv;
}

char *itostr3(const int &xx)
{
  conv[0]=(xx/100)%10+'0';
  conv[1]=(xx/10)%10+'0';
  conv[2]=(xx)%10+'0';
  conv[3]=0;
  return conv;
}

char *itostr4(const int &xx)
{
  conv[0]=(xx/1000)%10+'0';
  conv[1]=(xx/100)%10+'0';
  conv[2]=(xx/10)%10+'0';
  conv[3]=(xx)%10+'0';
  conv[4]=0;
  return conv;
}

//  convert float to string with +1234.5 format
char *ftostr51(const float &x)
{
  int xx=x*10;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/10000)%10+'0';
  conv[2]=(xx/1000)%10+'0';
  conv[3]=(xx/100)%10+'0';
  conv[4]=(xx/10)%10+'0';
  conv[5]='.';
  conv[6]=(xx)%10+'0';
  conv[7]=0;
  return conv;
}

//  convert float to string with +123.45 format
char *ftostr52(const float &x)
{
  int xx=x*100;
  conv[0]=(xx>=0)?'+':'-';
  xx=abs(xx);
  conv[1]=(xx/10000)%10+'0';
  conv[2]=(xx/1000)%10+'0';
  conv[3]=(xx/100)%10+'0';
  conv[4]='.';
  conv[5]=(xx/10)%10+'0';
  conv[6]=(xx)%10+'0';
  conv[7]=0;
  return conv;
}

suite et fin du topic

[/code]
Le code pour l'inclusion Lcd4d

#ifndef LCD4D_H
#define LCD4D_H

#define LCD4D_WIDTH 57
#define LCD4D_UPDATE_INTERVAL 100

#define MESSAGE_ID "M:"
#define HOTEND0_ID "H0:"
#define HOTEND1_ID "H1:"
#define THOTEND0_ID "T0:"
#define THOTEND1_ID "T1:"
#define TBED_ID "B:"
#define TTBED_ID "TB:"
#define TIME_ID "t:"
#define ZPOS_ID "Z:"
#define SDPERCENT_ID "S:"
#define FEEDMULTIPLY_ID "F:"
#define SOUND_ID "s:"

//#define LCD4D_CHECKDATA lcd4d_incoming();
//#define LCD_FORCE_UPDATE lcd4d_force_update();
//#define LCD_INIT lcd4d_init();
//#define LCD_STATUS lcd4d_status();
//#define LCD_MESSAGE(x) lcd4d_status(x);
//#define LCD_MESSAGEPGM(x) lcd4d_statuspgm(MYPGM(x));
//#define LCD_FINISH_SOUND lcd4d_finishSound();

#define WELCOME_MSG "CNC Ready."
#define MYSERIAL1 Serial1

#define MYPGM(s) PSTR(s)
#define SERIAL1_PROTOCOL(x) MYSERIAL1.print(x);
#define SERIAL1_PROTOCOL_F(x,y) MYSERIAL1.print(x,y);
#define SERIAL1_PROTOCOLPGM(x) serial1printPGM(MYPGM(x));
#define SERIAL1_PROTOCOLLN(x) {MYSERIAL1.print(x);MYSERIAL1.write('\n');}
#define SERIAL1_PROTOCOLLNPGM(x) {serial1printPGM(MYPGM(x));MYSERIAL1.write('\n');}

const char errormagic[] PROGMEM ="Error:";
const char echomagic[] PROGMEM ="echo:";

#define SERIAL1_ERROR_START serial1printPGM(errormagic);
#define SERIAL1_ERROR(x) SERIAL1_PROTOCOL(x)
#define SERIAL1_ERRORPGM(x) SERIAL1_PROTOCOLPGM(x)
#define SERIAL1_ERRORLN(x) SERIAL1_PROTOCOLLN(x)
#define SERIAL1_ERRORLNPGM(x) SERIAL1_PROTOCOLLNPGM(x)

#define SERIAL1_ECHO_START serial1printPGM(echomagic);
#define SERIAL1_ECHO(x) SERIAL1_PROTOCOL(x)
#define SERIAL1_ECHOPGM(x) SERIAL1_PROTOCOLPGM(x)
#define SERIAL1_ECHOLN(x) SERIAL1_PROTOCOLLN(x)
#define SERIAL1_ECHOLNPGM(x) SERIAL1_PROTOCOLLNPGM(x)

#define Serial1printPGM(x) serial1printPGM(MYPGM(x))

#define  FORCE_INLINE __attribute__((always_inline)) inline

FORCE_INLINE void serial1printPGM(const char *str)
{
  char ch=pgm_read_byte(str);
  while(ch)
  {
    MYSERIAL1.write(ch);
    ch=pgm_read_byte(++str);
  }
}

/*
void lcd4d_init();
void lcd4d_update();
void lcd4d_status();
void lcd4d_status(const char* message);
void lcd4d_status();
void lcd4d_statuspgm(const char* message);
void lcd4d_showStatus();
void lcd4d_finishSound();
void lcd4d_incoming();
void lcd4d_force_update();
*/

char *ftostr3(const float &x);
char *itostr2(const uint8_t &x);
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *itostr31(const int &xx);
char *itostr3(const int &xx);
char *itostr4(const int &xx);
char *ftostr51(const float &x);

#endif // LCD4D

Cela commence à devenir assez conséquent. Je suis pas très expert, si vous pouvez me corriger, critiquer sur l'organisation, la structure...

Bonne soirée.

Tu n'as pas d'autres informations sur l'erreur de compilation? Est-ce que tu as activé, dans les réglages, "afficher les résultats détaillés"? En principe ça pointe du doigt ce qui pose problème.

J'ai modifié aucun paramètre.

C'est dès que je décommente la ligne 64 ou 66.

Le compilateur m'affiche:

SERIAL:64: error: expected primary-expression before 'const'

lcd4d_status(const char* message);

             ^

SERIAL:66: error: expected primary-expression before 'const'

lcd4d_statuspgm(const char* message);

                ^
Error compiling for board Arduino/Genuino Mega or Mega 2560."

Merci de ta patience!

Là je ne sais pas trop quoi te dire. Je ne connais pas suffisamment les subtilités du C / C++ pour savoir si ça vient de la double définition de la fonction en dehors de la définition d'une classe (auquel cas quand tu décommente l'un, commente l'autre), si ça vient du passage de variable par pointeur constant (pas encore tout à fait bien compris le mécanisme, et je n'ai pas réussi à le faire fonctionner sur Arduino), ou si ça vient d'encore autre chose. D'où vient le code? Il n'y a pas des exemples avec?

Bonjour,

Je ne vois pas ce que tu veux faire.

Si c'est une déclaration c'est

void lcd4d_status(const char* message);

Si c'est un appel à la focntion c'est

lcd4d_status("mon_message");

ou tu remplaces "mon_message" par le message que tu veux utiliser.

Bonsoir,

troisiemetype:
D'où vient le code? Il n'y a pas des exemples avec?

J'ai réalisé ce code à partir des exemples comme par "sérial évent" "déclaration de fonction" .... souvent à partir Arduino Learning.

kamill:
Je ne vois pas ce que tu veux faire.

Si c'est une déclaration c'est

void lcd4d_status(const char* message);

Je veux créer une déclaration.

Sur l'écran µLCD lui même programmable(4dgl), envoi des messages sur la liaison série 1 (Méga).

Je pense que mon erreur vient au niveau de l'appel de l'extension de fichier.

Cordialement