Cause of apparant byte swap from I2C read?

I am writing code to drive a LTR-559 light and distance sensor via the Wire library and an Arduino UNO. As a tiny first step I am reading two manufacturer placed fixed bytes at register addresses 0x86 and 0x87. I use these because I know exactly what the incoming data should contain. When I bring the data in using two Wire.requestFrom() requests it comes in the wrong way round (last first). When I ask for two bytes through a single request it comes in the correct sequence. I need to understand clearly what is going on otherwise I can have no confidence in the more involved real command exchanges that will be needed.

The code below contains both versions, except that the version that “works” as I expect is commented out.

This is likely to be something silly. Because it works one way and not the other I am sort of assuming the problem is at my end or in the library somehow. If not it’s in the device (which has atrocious documentation!). Any pointers would be welcomed.

#include <Wire.h>

int const device = 0x23;
int distance = 0;
byte part_id = 0;
byte manufac_id = 0;
float lux;
int sensor_status;
int ch0, ch1;
byte RXdat[2];

void setup() {
  Wire.begin();        // join i2c bus (address optional for master)
  Wire.setClock(400000L);
  Serial.begin(9600);  // start serial for output
  delay(100);          //let sensor boot up  Wire.write(0x86);
  flushinput();

}

void flushinput()
{
  //read the i2c input buffer until it is empty (to make sure)
  while(Wire.available()>0){Wire.read();}
  return;
}
void loop() {
/*
  Wire.beginTransmission(device);

  //load in the device manufacture data
  Wire.write(0x86);
  ch0 = Wire.requestFrom(device,2);
  int inx = 0;
  for(inx = 0; inx < ch0; inx++)
  {
    RXdat[inx] = Wire.read();
  }
  part_id = RXdat[0];
  manufac_id = RXdat[1];
  Wire.endTransmission();
*/
flushinput();
Wire.beginTransmission(device);
  Wire.write(0x86);
  ch1 = Wire.requestFrom(device,1);
  part_id = Wire.read(); 
  Wire.endTransmission();  
Wire.beginTransmission(device);
  Wire.write(0x87);
  ch1 = Wire.requestFrom(device,1);
  manufac_id = Wire.read(); 
  Wire.endTransmission();               
  Serial.print("maker data =  ");Serial.print(part_id); Serial.print("  ");Serial.println(manufac_id);
  Serial.print("status =  ");Serial.print(ch0); Serial.print("  ");Serial.println(ch1);
  delay(1000);
 }

You are using an 8 bit slave address.

aarg thanks, that was me skim reading the device specification where it said it gave a 7 bit address (0x23) but did so with 8 bit placement. Some time I will work out how I got anything at all.

I have modified the code so the device address is now 0x46 and also reworked the sequence in line with the SFRxx Sonic Range Finder example in the Wire documentation and it works. Am I correct in assuming that the Wire library modifies the read/write bit itself?

Wire.beginTransmission(device);
  Wire.write(0x86);
  Wire.endTransmission();  
  ch0 = Wire.requestFrom(device,1);
  part_id = Wire.read();   
Wire.beginTransmission(device);
  Wire.write(0x87);
  Wire.endTransmission();  
  ch1 = Wire.requestFrom(device,1);
  manufac_id = Wire.read();                
  Serial.print("maker data =  ");Serial.print(part_id); Serial.print("  ");Serial.println(manufac_id);
  Serial.print("status =  ");Serial.print(ch0); Serial.print("  ");Serial.println(ch1);

Yes, that is it.