Jump to content
The simFlight Network Forums
Sign in to follow this  
zuby

HID buffer writing problem

Recommended Posts

zuby    0

hello everyone,
I made a program in mikroc compiler that reads hid buffer values and write that values to the 7 segment display.  I copied below ipcready.lua file into fsx modules folder, that file writes air speed values to hid buffer. but com.writefeature is not working i think.

Vendor = 0x1234

	Product = 0x0001

	Device = 0

	Report = 0


dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report)

if dev == 0 then
   ipc.log("Could not open HID")
   ipc.exit()
end

-- Finish HID Connect

function call_speed (offset, value)
    
    dev = ipc.get("dev")
    wrf = ipc.get("wrf")
    com.writefeature(dev,string.format("%03d", value), wrf) 
    --ipc.sleep(serial_wait)
end


-- Arduino Gauges/Servos
event.offset (0x07E2, "UW", "call_speed") -- aircraft speed


 

In mikroc program im reading buffer and put values into 7 segment display like below:

while(1)
    {

          if(HID_Read() != 0) {
            
            AsciiToChar(&readbuff);
            SevenSegmentPrint(ss,(int)atoi(readbuff));

           }
         SetADCInputToUSBBuffer();
    }

can anyone help how can i resolve the issue?

Edited by zuby

Share this post


Link to post
Share on other sites
Pete Dowson    155

This post seems to be a more elaborate version of a post I already answered.

On 8/30/2017 at 10:00 AM, zuby said:

dev = ipc.get("dev")
wrf = ipc.get("wrf")

Where are these Global variables being set?

Please also see my other reply.

Please stick to one thread per subject in furture to avoid extra work and confusion.

Pete

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×