Hello, all:

I edited the java code in Oscilloscope to display the data received, in the
Node class, I have the following function to update data:

void update(int type, int reading) {
        for (int i=Store-1;i>0;i--)
            Data[type][i] = Data[type][i-1];
        Data[type][0] = reading;
 }

but when I tested it, I found that only Data[type][0] is updated, but all
the following data did not change (from Data[type][1] to Data[type][Store -
1]), can someone tell me what is the problem?
Thanks very much.

The edited Node class:

class Node {
    /*
     * 0 for temperature
     */
    final static int Var = 5;  // how many things to measure, tem etc, now
only measure temperature
    final static int Store = 100; // how many data to store

    /* The mote's identifier */
    int id;

    int[][] Data = new int[Var][Store];
    //int dataStart, dataEnd;

    Node(int _id) {
    id = _id;
    }


    /* Data received containing NREADINGS samples from messageId * NREADINGS

       onwards */
    void update(int type, int reading) {
        for (int i=Store-1;i>0;i--)
            Data[type][i] = Data[type][i-1];
        Data[type][0] = reading;
    }

    /* Return value of sample x, or -1 for missing data */
    int getData(int type, int x) {
    if (x < 0 || x >= Store)
        return 0;

    if(type<0 || type >= Var)
        return 0;

    else
        return Data[type][x];
    }
    /*
    // Return number of last known sample
    int maxX() {
    return 1;
    }
    */
}


Best Regards,
CHEN WEIMING
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to