diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-05-07 02:36:24 -0700 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-05-07 02:36:24 -0700 |
commit | f68d4c04ba23d89f3984f398d8d4298885d7b794 (patch) | |
tree | b2fdc79c014bbb875f15000d553bc35842086e17 /remote_plot.c | |
parent | 29d054c2b4c680a586c6ab9d12e2d59a106a4bc4 (diff) |
Fix first time start offset==0 cause read_data read data from remote and write duplicate data to local
Diffstat (limited to 'remote_plot.c')
-rw-r--r-- | remote_plot.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/remote_plot.c b/remote_plot.c index f7031b3..fcd018a 100644 --- a/remote_plot.c +++ b/remote_plot.c @@ -263,6 +263,8 @@ typedef struct { char *filename; // only read from local .csv file or not bool local; + // just start up the program + bool just_start; }DATA; static gboolean read_data(gpointer user_data) @@ -273,8 +275,10 @@ static gboolean read_data(gpointer user_data) DATA *data=user_data; bool new_entry=false; - if(data->local) + if(data->local || data->just_start) { + data->just_start=false; + //printf("read_data check local pass\n"); FILE *fp; if((fp=fopen(data->filename,"r"))!=NULL) @@ -923,6 +927,7 @@ int main (int argc, char **argv) data.from_time_entered=false; data.offset=0; data.local=false; + data.just_start=true; //printf("after init\n"); |