Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Thread_Communication_V4_fortest by
Revision 17:aa585f901750, committed 2018-01-06
- Comitter:
- benparkes
- Date:
- Sat Jan 06 19:44:43 2018 +0000
- Parent:
- 16:f30928e622a2
- Child:
- 18:728fddea6d9c
- Commit message:
- new
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jan 06 18:05:43 2018 +0000
+++ b/main.cpp Sat Jan 06 19:44:43 2018 +0000
@@ -127,8 +127,12 @@
if (evt.status == osEventMail) {
mail_t *mail = (mail_t*)evt.value.p;
-
- sprintf(data_buffer[sample_h],"%s, %2.2f, %4.2f, %.4f\n\r", mail->Time_Date, mail->temp_Value, mail->press_Value, mail->LDR_Value);
+ char sample_time[21];
+ int rTime = mail->Time_Date;
+ time((time_t*)rTime);
+ sample_epoch = localtime((time_t*)rTime);
+ strftime(sample_time, 21,"%d/%m/%Y, %X", sample_epoch);
+ sprintf(data_buffer[sample_h],"%s, %2.2f, %4.2f, %.4f\n\r", sample_time, mail->temp_Value, mail->press_Value, mail->LDR_Value);
mail_FIFO.free(mail);
}
@@ -195,14 +199,14 @@
mail_LCD.put(mail);
mail_t *mail1 = mail_FIFO.alloc();
- strcpy(mail1->Time_Date, (char*)TIME);
+ mail1->Time_Date = raw_time;
mail1->LDR_Value = LDR;
mail1->temp_Value = TEMP;
mail1->press_Value = PRES;
mail_FIFO.put(mail);
mail_t *mail2 = mail_Network.alloc();
- strcpy(mail2->Time_Date, (char*)TIME);
+ mail1->Time_Date = raw_time;
mail2->LDR_Value = LDR;
mail2->temp_Value = TEMP;
mail2->press_Value = PRES;
--- a/main.h Sat Jan 06 18:05:43 2018 +0000
+++ b/main.h Sat Jan 06 19:44:43 2018 +0000
@@ -77,7 +77,7 @@
/* Mail */
typedef struct {
- char Time_Date[21];
+ int Time_Date;
float LDR_Value;
float temp_Value;
float press_Value;
