void cek_mesin(int argc, char **argv) { int i; unsigned char buf[24]; int no_mesin; printf(" Mesin data"); if (argc < 2) { printf(" global\r\n"); garis_bawah(); for (i=0; i<10; i++) { printf(" (%2d): %10s\r\n", (i+1), mesin[i].nama); } return; } else { // cek titik dari nomer mesin yang dimasukkan sprintf(buf, "%s", argv[1]); no_mesin = cek_nomer_sumber(buf, 10); if (no_mesin > 0) { printf(" pada mesin = %d\r\n", no_mesin); cek_titik((int) no_mesin); } else return; } }
void getdef_env(int argc, char **argv) { printf(" Set Default Environtment \r\n"); garis_bawah(); set_default_ip(); printf(" OK\n"); }
static int uname(int argc, char **argv) { int i; struct t_env *p_env; int sumb; unsigned char buf[24]; int y=0; p_env = (char *) ALMT_ENV; p_env = pvPortMalloc(sizeof (struct t_env) ); if (p_env == NULL) { printf(" %s(): ERR allok memory gagal !\r\n", __FUNCTION__); return -1; } printf(" Ukuran %d !\r\n", (sizeof (struct t_env))); if (argc == 1) { judul(" Lingkungan Setting\r\n"); printf(" ID : Nama : Status : Keterangan : Jum Data : &Memory\r\n"); garis_bawah(); printf(" IP : %d.%d.%d.%d\r\n", p_env.IP0,p_env.IP1,p_env.IP2.p_env.IP3); } }
void save_env(int argc, char **argv) { printf(" Saving environtment\r\n"); garis_bawah(); tulis_env(); printf("\r\n"); }
static int cek_file(int argc, char **argv) { int i; struct t_simpan_file *psfile; struct t_dt_set *dt; int sumb; //unsigned char string_file[24]; int y=0; psfile = (char *) ALMT_SFILE; dt = (char *) ALMT_DT_SET; //printf(" Ukuran %d !\r\n", sizeof (struct t_simpan_file)); if (argc == 1) { judul(" Setting Simpan File\r\n"); printf(" Nama = %s\r\n", psfile->nama_file); printf(" Periode = %d menit\r\n", psfile->periode); printf(" Set = %s\r\n", ((psfile->set)?"Aktif [1]":"Mati [0]")); printf(" Detik ke = %d\r\n", psfile->detik); garis_bawah(); sumb= 0; printf(" No : No_Data : Nama : Satuan \r\n"); //* for (i=0; i< (JML_SUMBER * PER_SUMBER); i++) { y = psfile->no_data[i]; if ( y != 0) { sumb++; printf(" %2d : %7d : %-16s : %-8s\r\n", sumb, y, dt[y-1].nama, dt[y-1].satuan ); } } //*/ } else if (argc > 1) { if (strcmp(argv[1], "help") == 0) { printf(" Perintah untuk menampilkan setting file !\r\n"); printf(" cek_file help : untuk menampilkan ini.\r\n"); } else { } } }
void cek_stack(void) { printf("Sisa stack masing2 task (bytes)\r\n"); garis_bawah(); printf(" Shell : %d\r\n", uxTaskGetStackHighWaterMark(hdl_shell)); printf(" Led : %d\r\n", uxTaskGetStackHighWaterMark(hdl_led)); #ifdef BOARD_TAMPILAN //#ifdef CARI_SUMBERNYA printf(" Tampilan : %d\r\n", uxTaskGetStackHighWaterMark(hdl_tampilan)); printf(" LCD : %d\r\n", uxTaskGetStackHighWaterMark(hdl_lcd)); #endif #if (TAMPILAN_MALINGPING == 1) //extern xTaskHandle hdl_proses_pm; matikan dulu, pm belum diaktifkan printf(" Tampilan : %d\r\n", uxTaskGetStackHighWaterMark(hdl_tampilan)); printf(" LCD : %d\r\n", uxTaskGetStackHighWaterMark(hdl_lcd)); #endif printf(" Ether : %d\r\n", uxTaskGetStackHighWaterMark(hdl_ether)); #ifdef PAKAI_SELENOID printf(" Relay : %d\r\n", uxTaskGetStackHighWaterMark(hdl_relay)); #endif #if defined(PAKAI_GSM_FTP) || defined(PAKAI_SMS) printf(" GSM : %d\r\n", uxTaskGetStackHighWaterMark(hdl_modem)); #endif #ifdef PAKAI_CRON printf(" CRON : %d\r\n", uxTaskGetStackHighWaterMark(hdl_cron)); #endif #ifdef AMBIL_PM // printf(" Proses PM: %d\r\n", uxTaskGetStackHighWaterMark(hdl_proses_pm)); #endif }
void set_mesin(int argc, char **argv) { unsigned char buf[24]; int sumb; unsigned int ret_ip; if (argc < 4) { if (argc > 1) { if (strcmp(argv[1], "help") == 0) { printf(" Setting mesin yang akan ditampilkan\r\n"); garis_bawah(); printf(" argument : help, default, nama\r\n"); printf(" help : printout keterangan ini\r\n"); printf(" default : load default setting mesin\r\n"); printf(" \r\n"); printf(" nama : memberikan nama mesin yang akan ditampilkan\r\n"); printf(" misalnya : $ set_mesin nama 1 GMT_#4\r\n"); printf(" artinya memberikan nama mesin 1 dengan GMT_#4\r\n"); return ; } else if (strcmp(argv[1], "default") == 0) { printf("set mesin dengan data default !\n"); set_awal_mesin(); return; } } printf(" ERR: argument kurang !\r\n"); printf(" coba set_mesin help \r\n"); return; } printf(" set_mesin %s dipanggil\r\n", argv[1]); garis_bawah(); display_args(argc,argv); if (strcmp(argv[1], "nama") == 0) { sprintf(buf, "%s", argv[2]); sumb = cek_nomer_sumber(buf, 10); if (sumb > 0) { printf(" mesin = %d : ", sumb); if (strlen(argv[3]) > 10) { printf("nama terlalu panjang !\r\n"); return; } sprintf(mesin[sumb-1].nama, argv[3]); printf(" Nama : %s\r\n", mesin[sumb-1].nama); } else return ; } else { printf(" ERR: perintah tidak benar !\r\n"); printf(" coba set_mesin help \r\n"); return; } }
void set_kanal(int argc, char **argv) { unsigned char buf[24]; unsigned int kanal; float m; float c; int ret; if (argc < 3) { if (argc > 1) { if (strcmp(argv[1], "help") == 0) { printf(" setting faktor kalibrasi kanal dengan y = mx + c, misalnya : \r\n"); printf(" set_kanal 3 1.34 -0.431\r\n"); printf(" artinya : setting kanal 3 dengan m = 1.34 dan C = -0.431\r\n"); printf(" \r\n"); printf(" set_kanal juga bisa untuk setting keterangan, misalnya :\r\n"); printf(" set_kanal 3 ket jacket_water_temp\r\n"); printf(" artinya : setting kanal 3 dengan keterangan 'jacket_water_temp'\r\n"); return; } else if (strcmp(argv[1], "default") == 0) { printf("set kanal dengan data default !\n"); set_dafault_kalib(); return; } } printf(" ERR: argument kurang !\r\n"); printf(" coba set_kanal help \r\n"); return; } printf(" set_kanal untuk kanal %s dipanggil\r\n", argv[1]); garis_bawah(); display_args(argc,argv); sprintf(buf, "%s", argv[1]); ret = sscanf(buf, "%d", &kanal); if (kanal > 10 || ret == NULL) { printf(" Err kanal !\r\n"); return ; } if (strcmp(argv[2], "ket") == 0) { printf(" Setting keterangan kanal %d :\r\n", kanal); sprintf(env2.kalib[kanal-1].ket, "%s", argv[3]); printf(" %s", env2.kalib[kanal-1].ket); } else { sprintf(buf, "%s", argv[2]); ret = sscanf(buf, "%f", &m); if (ret == NULL) { printf(" Err m !\r\n"); return ; } sprintf(buf, "%s", argv[3]); ret = sscanf(buf, "%f", &c); if (ret == NULL) { printf(" Err C !\r\n"); return ; } printf(" Seting kanal %d, m = %f, dan C = %f\r\n", kanal, m, c); env2.kalib[kanal - 1].m = m; env2.kalib[kanal - 1].C = c; } }
int baca_env(char tampil) { struct t_env *ev; int i; char teku[128]; if (tampil == 1) { printf(" Data Environtment \r\n"); garis_bawah(); } else { /* pada saat awal start, pasti akses ini dulu */ ev = (struct t_env *) 0x7A000; memcpy((char *)&env2, (char *) 0x7A000, sizeof (env2)); } if (ev->magic1 == 0xAA) { if (ev->magic2 == 0x77) { printf(" Nama board = "); printf(env2.nama_board); printf("\r\n IP Address = "); printf("%d.%d.%d.%d\r\n", env2.IP0, env2.IP1, env2.IP2, env2.IP3); // tampilkan GW address, pakai env2 sekalian buat ngetes printf(" Gateway IP = "); printf("%d.%d.%d.%d\r\n", env2.GW0, env2.GW1, env2.GW2, env2.GW3); if (tampil == 1) { printf(" Faktor kalibrasi (y = mx + C) :\r\n"); extern char tek; double ff = 0.123; int t; /* portENTER_CRITICAL(); //snprintf(teku, 64, " float %f", ff); //teku = (char *) fcvt(ff, 6, i, t); printf("%f", ff); portEXIT_CRITICAL(); */ for (i=0; i<20; i++) { printf(" (%2d) m = %3.3f, C = %3.3f", i+1, env2.kalib[i].m, env2.kalib[i].C); i++; printf(" (%2d) m = %3.3f, C = %3.3f\r\n", i+1, env2.kalib[i].m, env2.kalib[i].C); } printf(" Keterangan kanal :\r\n"); for (i=0; i<20; i++) { printf(" (%2d) %s\r\n", i+1, env2.kalib[i].ket); } printf("\n"); } return 0; } else { printf(" Magic number2 salah !\r\n"); set_default_ip(); return -1; } } else { printf(" Magic number1 salah !\r\n"); set_default_ip(); return -1; } }