11-03-2021, 11:51 AM
Sorry, I somehow missed the notification for your reply.
I did not yet have a chance to test your code, but I think the problem is that you are requesting the channels separately and therefore are requesting faster than the phone can respond. Your request to PP_CHANNELS_def seems to work fine, but your request to PP_CHANNELS_def_x follows without a delay and I would not be surprised if the (single-threaded) web server on the phone is not yet ready.
In any case, this is not a good idea. You should ask for all channels in a single request to keep the network load low, but also to keep the reference time consistent (i.e. what happens if there is one new data point between requesting the y and the z axis?). So, simply request them all in one go:
get?acc_time=42&accX=42|acc_time&accY=42|acc_time&accZ=42|acc_time
I did not yet have a chance to test your code, but I think the problem is that you are requesting the channels separately and therefore are requesting faster than the phone can respond. Your request to PP_CHANNELS_def seems to work fine, but your request to PP_CHANNELS_def_x follows without a delay and I would not be surprised if the (single-threaded) web server on the phone is not yet ready.
In any case, this is not a good idea. You should ask for all channels in a single request to keep the network load low, but also to keep the reference time consistent (i.e. what happens if there is one new data point between requesting the y and the z axis?). So, simply request them all in one go:
get?acc_time=42&accX=42|acc_time&accY=42|acc_time&accZ=42|acc_time