Two different sketch, the same code, libraries and HW: different results...

I can’t understand the reason… the first goes, the second has problem with Wire.endTransmission();…

but, except the sketch name (and directory), the use the same thing… (also the same inclusion)
firts code:

System sys = System(LCD_ROW, LCD_COLUMN, KEYPAD_ROW, KEYPAD_COLUMN);
char key = '\0';
boolean colon = false;
uint8_t second = 0;

void setup(){
  Serial.begin(9600);
  Wire.begin();
  sys.begin();
  sock.begin();

second code

System sys = System(LCD_ROW, LCD_COLUMN, KEYPAD_ROW, KEYPAD_COLUMN);
char key = '\0';
boolean colon = false;
uint8_t second = 0;

void setup(){
  Serial.begin(9600);
  Wire.begin();
  sys.begin();
  sock.begin();

libraries: (Sockets creates an instance of itself alone (as Wire))
System.cpp

System::System(uint8_t lcdRow, uint8_t lcdColumn, uint8_t keypadRow, uint8_t keypadColumn){
	_lcdRow = lcdRow;
	_lcdColumn = lcdColumn;
	  
	_keypadRow = keypadRow;
	_keypadColumn = keypadColumn;
	
	_backlight = false;
}

void System::begin(){
	// SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
	// according to datasheet, we need at least 40ms after power rises above 2.7V
	// before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
	delayMicroseconds(50000); 
  
	// Now we pull both RS and R/W low to begin commands
	expanderWrite((_backlight ? LCD_BACKLIGHT : LCD_NOBACKLIGHT));	// reset expanderand turn backlight off (Bit 8 =1)
	delay(1000);

  	//put the LCD into 4 bit mode
	// this is according to the hitachi HD44780 datasheet
	// figure 24, pg 46
	
	// we start in 8bit mode, try to set 4 bit mode
	write4bits(0x03);
	delayMicroseconds(4500); // wait min 4.1ms
	
	// second try
	write4bits(0x03);
	delayMicroseconds(4500); // wait min 4.1ms
	
	// third go!
	write4bits(0x03); 
	delayMicroseconds(150);
	
	// finally, set to 4-bit interface
	write4bits(0x02); 


	// set # lines, font size, etc.
	send(LCD_FUNCTIONSET | LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS | LCD_2LINE);  
	
	// turn the display on with no cursor or blinking default
	send(LCD_DISPLAYCONTROL | LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF);
	
	// clear it off
	clearLcd();
	
	// Initialize to default text direction (for roman languages); set the entry mode
	send(LCD_ENTRYMODESET | LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT);
	
	send(LCD_RETURNHOME);  // set cursor position to zero
	delayMicroseconds(2000);  // this command takes a long time!
	
	lcdBacklight(true);
	
	_currentLcdRow = _secondsWithoutInput = 0;
	refreshClock();
	_lastSecond = getSecond();
}

void System::send(uint8_t value, uint8_t mode) {
	write4bits((value>>4) | mode);
	write4bits((value & 0x0F) | mode);
}

void System::write(uint8_t value) {
	write4bits((value>>4) | Rs);
	write4bits((value & 0x0F) | Rs);
}

void System::write4bits(uint8_t value) {
	expanderWrite(value);
	pulseEnable(value);
}

void System::expanderWrite(uint8_t data){                                        
	Wire.beginTransmission(LCD_ADDRESS);
	Wire.send((int)(data) | (_backlight ? LCD_BACKLIGHT : LCD_NOBACKLIGHT));
	Wire.endTransmission();   
}

void System::pulseEnable(uint8_t _data){
	expanderWrite(_data | En);	// En high
	delayMicroseconds(1);		// enable pulse must be >450ns
	
	expanderWrite(_data & ~En);	// En low
	delayMicroseconds(50);		// commands need > 37us to settle
}

Sockets.cpp

Sockets::Sockets(){
	_totSocket = -1;
	_ls.day = LS_MAX_DAY;
	_ls.minutes = LS_MAX_MINUTES;
}

void Sockets::begin(){	
	if(!isMemoryCorrect())
		formatMemory();
}


bool Sockets::isMemoryCorrect(){
	return eepromReadData(POSITION_STATUS_MEMORY) == CORRECT_MEMORY;
}

void Sockets::formatMemory(){
	eepromWriteData(POSITION_STATUS_MEMORY, CORRECT_MEMORY);
	eepromWriteData(POSITION_STATUS_MEMORY + 1, 0);// versione del programma "0"
	eepromWriteData(POSITION_STATUS_MEMORY + 2, 0);// ultimo programma usato "0"
}

void Sockets::eepromConnectPage(int page){
	Wire.beginTransmission((int) EEPROM_ADDRESS);
	Wire.send((byte)((page) >> 8));
	Wire.send((byte)((page) & 0xFF));
}

byte Sockets::eepromReadData(int page){
	eepromConnectPage(page);
	Wire.endTransmission();
	Wire.requestFrom((int) EEPROM_ADDRESS, sizeof(byte));
	return Wire.receive();
}

With some Serial.print I’ve established that (only) in the second sketch it’s wait the firts Wire.endTransmission();…

the first sketch, instead, works almost normally … (do not turn the light on the LCD… though, trying other sketches (which were correctly) reflected the same problem … so I think it is due to a link …)

but… for the “Wire.endTransmission();” some idea?