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.
Dependencies: C12832_lcd LCD_fonts
Revision 3:3569342a4ab0, committed 2015-02-18
- Comitter:
- yukari_hinata
- Date:
- Wed Feb 18 15:01:52 2015 +0000
- Parent:
- 2:459f757bd2f4
- Child:
- 4:1d811ee32310
- Commit message:
Changed in this revision
| GraphicHandler.cpp | Show annotated file Show diff for this revision Revisions of this file |
| GraphicHandler.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/GraphicHandler.cpp Sun Feb 15 09:27:58 2015 +0000
+++ b/GraphicHandler.cpp Wed Feb 18 15:01:52 2015 +0000
@@ -2,11 +2,12 @@
#include "graphics.hpp"
// コンストラクタ
-GraphicHandler::GraphicHandler(int data_dimension, int seq_time_interval, int predict_length)
+GraphicHandler::GraphicHandler(int data_dimension, int seq_time_interval, int predict_length, time_t init_time)
{
- this->data_dimension = data_dimension;
- this->seq_time_interval = seq_time_interval;
- this->predict_length = predict_length;
+ this->data_dimension = data_dimension;
+ this->seq_time_interval = seq_time_interval;
+ this->predict_length = predict_length;
+ this->now_time = init_time;
// アロケート
now_data = new float[data_dimension];
@@ -15,8 +16,8 @@
predict_probability = new float[predict_length];
// ティッカー初期化
- time_ticker.attach(this, &GraphicHandler::update_time, 60.0);
- image_ticker.attach(this, &GraphicHandler::update_image, 1.0);
+ // time_ticker.attach(this, &GraphicHandler::update_time, 60.0);
+ // image_ticker.attach(this, &GraphicHandler::update_image, 1.0);
// ジョイスティック割り込み設定 : p13が左, p16が右
joy_left = new InterruptIn(p13);
@@ -63,8 +64,8 @@
void GraphicHandler::joyleft_isr(void)
{
current_display_no++;
- update_draw();
- printf("JOYSTICK LEFT FIRED DISP_NO:%d \r\n", current_display_no);
+ //update_draw();
+ //printf("JOYSTICK LEFT FIRED DISP_NO:%d \r\n", current_display_no);
}
@@ -72,8 +73,8 @@
void GraphicHandler::joyright_isr(void)
{
current_display_no--;
- update_draw();
- printf("JOYSTICK RIGHT FIRED DISP_NO:%d \r\n", current_display_no);
+ //update_draw();
+ //printf("JOYSTICK RIGHT FIRED DISP_NO:%d \r\n", current_display_no);
}
// 時間の更新
@@ -115,8 +116,8 @@
draw_text_at("Now", (unsigned char *)Arial_9, 0, 0);
// データ
draw_data_at(now_data[0], "C", (unsigned char *)Small_7, 37, 4);
- draw_data_at(now_data[1], "%%", (unsigned char *)Small_7, 37, 12);
- draw_data_at(now_data[2], "hPa", (unsigned char *)Small_7, 37, 20);
+ draw_data_at(now_data[1], "hPa", (unsigned char *)Small_7, 37, 12);
+ draw_data_at(now_data[2], "%%", (unsigned char *)Small_7, 37, 20);
// 時刻
draw_time_at((unsigned char *)Arial_9, 0, 5, 10);
} else {
@@ -124,16 +125,14 @@
int base_index = data_dimension * (current_display_no-1);
draw_text_at("Predict", (unsigned char *)Arial_9, 0, 0);
draw_data_at(predict_data[base_index], "C", (unsigned char *)Small_7, 37, 4);
- draw_data_at(predict_data[base_index + 1], "%%", (unsigned char *)Small_7, 37, 12);
- draw_data_at(predict_data[base_index + 2], "hPa", (unsigned char *)Small_7, 37, 20);
+ draw_data_at(predict_data[base_index + 1], "hPa", (unsigned char *)Small_7, 37, 12);
+ draw_data_at(predict_data[base_index + 2], "%%", (unsigned char *)Small_7, 37, 20);
draw_weather_bitmap_at(predict_weather[current_display_no-1], current_image_no, 87, 2);
draw_percentage_at(predict_probability[current_display_no-1], (unsigned char *)Small_6, 112, 25);
// 予測時刻
draw_time_at((unsigned char *)Arial_9, seq_time_interval * current_display_no, 5, 10);
}
-
-
}
// テキストの描画ルーチン
@@ -188,7 +187,7 @@
time_t buf_time;
// 経過時間が指定された場合は予測時刻であることがわかる
if (elapsed_time > 0) {
- buf_time = last_learned_time + elapsed_time * 60;
+ buf_time = last_learned_time + elapsed_time;
} else if (elapsed_time == 0) {
buf_time = now_time;
} else {
--- a/GraphicHandler.hpp Sun Feb 15 09:27:58 2015 +0000
+++ b/GraphicHandler.hpp Wed Feb 18 15:01:52 2015 +0000
@@ -28,8 +28,8 @@
float* predict_data; // 予測データ
float* predict_probability;// 予測天候確率
int* predict_weather; // 予測天候の列
- Ticker time_ticker; // 時間更新用のティッカー
- Ticker image_ticker; // ビットマップアニメーションのティッカー
+ // Ticker time_ticker; // 時間更新用のティッカー -> 廃止. main側で更新
+ // Ticker image_ticker; // ビットマップアニメーションのティッカー -> 廃止.
InterruptIn* joy_left; // ジョイスティックの操作割り込み入力
InterruptIn* joy_right;
C12832_LCD lcd; // ステータス表示ターゲットのLCD
@@ -38,7 +38,8 @@
// やること: now_timeの大麻割り込み設定, predic_lenの設定, 配列アロケート
GraphicHandler(int, // 観測データの次元(現在, 温度/気圧/湿度で3)
int, // 時間間隔
- int); // 予測系列の長さ.
+ int, // 予測系列の長さ.
+ time_t); // 初期設定時間
~GraphicHandler(void);