3
3
// ** **
4
4
// ** Arduino DMX-512 Tester Controller **
5
5
// ** **
6
- // ** - Firmware v1.3 **
7
- // ** - Hardware v0.4 **
6
+ // ** - Firmware v1.4 **
7
+ // ** - Hardware v0.4 **
8
8
// ** **
9
9
// ** - Compilado en Arduino IDE v1.0.6 **
10
10
// ** - Editado en Note++ **
@@ -405,7 +405,7 @@ void GUI_Licence()
405
405
void GUI_About ()
406
406
{
407
407
byte Firm_Ver_Ent = 1 ;
408
- byte Firm_Ver_Dec = 3 ;
408
+ byte Firm_Ver_Dec = 4 ;
409
409
byte Hard_Ver_Ent = 0 ;
410
410
byte Hard_Ver_Dec = 4 ;
411
411
byte Key_Light_Value = EEPROM.read (Key_Light_Add);
@@ -539,7 +539,7 @@ void GUI_Control_Matrix()
539
539
inicio:
540
540
lcd.clear ();
541
541
lcd.setCursor (0 , 0 );
542
- lcd.print (" c--- Mb Ctr -" );
542
+ lcd.print (" c--- Mb Exi -" );
543
543
lcd.setCursor (7 , 0 );
544
544
if (Universo_Actual == 0 )
545
545
{
@@ -1359,7 +1359,7 @@ void GUI_Control_Secuencer()
1359
1359
lcd.setCursor (4 , 1 );
1360
1360
lcd.print (" Delay 001x100=mS" );
1361
1361
lcd.setCursor (0 , 2 );
1362
- lcd.print (" FirstBank 001 Ctrl " );
1362
+ lcd.print (" FirstBank 001 Exit " );
1363
1363
lcd.setCursor (0 , 3 );
1364
1364
lcd.print (" FinalBank 008 Start" );
1365
1365
// Cursor
@@ -2005,8 +2005,8 @@ void GUI_Control_Options()
2005
2005
inicio:
2006
2006
// LCD
2007
2007
lcd.clear ();
2008
- lcd.setCursor (0 , 0 );
2009
- lcd.print (" Control: b" );
2008
+ lcd.setCursor (18 , 0 );
2009
+ lcd.print (" b" );
2010
2010
if (Universo_Actual == 0 )
2011
2011
{
2012
2012
lcd.print (" -" );
@@ -2015,6 +2015,8 @@ void GUI_Control_Options()
2015
2015
{
2016
2016
lcd.print (Universo_Actual);
2017
2017
}
2018
+ lcd.setCursor (2 , 0 );
2019
+ lcd.print (" Convert" );
2018
2020
lcd.setCursor (2 , 1 );
2019
2021
lcd.print (" Unitary" );
2020
2022
lcd.setCursor (2 , 2 );
@@ -2042,6 +2044,7 @@ void GUI_Control_Options()
2042
2044
Cursor_Conf[0 ][10 ] = 1 ; // Config
2043
2045
Cursor_Conf[2 ][10 ] = 1 ; // Secuencer
2044
2046
Cursor_Conf[1 ][10 ] = 1 ; // Memory
2047
+ Cursor_Conf[0 ][1 ] = 1 ; // Convert
2045
2048
// navegar
2046
2049
GUI_Navegar (0 , 0 );
2047
2050
// Acciones
@@ -2075,6 +2078,11 @@ void GUI_Control_Options()
2075
2078
{
2076
2079
GUI_Control_Secuencer ();
2077
2080
}
2081
+ // Converter
2082
+ if (LCD_Col_Pos == 1 && LCD_Row_Pos == 0 )
2083
+ {
2084
+ GUI_Convert ();
2085
+ }
2078
2086
// Memory
2079
2087
if (LCD_Col_Pos == 10 && LCD_Row_Pos == 1 )
2080
2088
{
@@ -2083,6 +2091,207 @@ void GUI_Control_Options()
2083
2091
}
2084
2092
}
2085
2093
2094
+ void GUI_Convert ()
2095
+ {
2096
+ int valor = 0 ; // aqui el valor a calcular
2097
+ int valor_temp = 0 ; // aqui el valor temporal para las cuentas
2098
+ int valor_resto = 0 ; // aqui el valor del resto de la divicion
2099
+ int valor_Bin [10 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }; // aqui el valor descompuesto en binario
2100
+ lcd.clear ();
2101
+ lcd.setCursor (0 , 0 );
2102
+ lcd.print (" Bin: OOOOOOOOO I=On" );
2103
+ lcd.setCursor (5 , 1 );
2104
+ lcd.print (" 124813612 O=Off" );
2105
+ lcd.setCursor (9 , 2 );
2106
+ lcd.print (" 62425" );
2107
+ lcd.setCursor (0 , 3 );
2108
+ lcd.print (" Dec: 000 86 Exit" );
2109
+ // Cursor
2110
+ LCD_Col_Pos = 4 ; // posicion de cursor
2111
+ LCD_Row_Pos = 3 ; // posicion e cursor
2112
+ // configuracion de cursor
2113
+ Cursor_Conf_Clear (); // limpiar array
2114
+ // Cursores
2115
+ Cursor_Conf[0 ][4 ] = 1 ; // Bin
2116
+ Cursor_Conf[3 ][4 ] = 1 ; // Dec
2117
+ Cursor_Conf[3 ][15 ] = 1 ; // Exit
2118
+ // Navegacion:
2119
+ calc:
2120
+ GUI_Navegar (0 , 0 );
2121
+ // Acciones
2122
+ // Exit
2123
+ if (LCD_Col_Pos == 15 && LCD_Row_Pos == 3 )
2124
+ {
2125
+ GUI_Control_Options ();
2126
+ }
2127
+ // Binario a decimal
2128
+ if (LCD_Col_Pos == 4 && LCD_Row_Pos == 0 )
2129
+ {
2130
+ // boton de centro para salir
2131
+ // boton de lados para navegar
2132
+ // boton arriba abajo para cambiar valor
2133
+ byte cursor = 5 ; // posicion de cursor
2134
+ int boton_retardo = 250 ; // retardo de boton para estabilidad
2135
+ byte calcular = 0 ; // calcular binario a decimal
2136
+ byte calcular_val = 0 ; // valor a meter a la matriz para calcular
2137
+ lcd.blink ();
2138
+ lcd.setCursor (5 , 0 );
2139
+ while (digitalRead (Boton_Center) == HIGH) // salida
2140
+ {
2141
+ if (digitalRead (Boton_Right) == LOW)
2142
+ {
2143
+ delay (boton_retardo); // esperar a estabilidad
2144
+ cursor = cursor + 1 ;
2145
+ if (cursor > 13 )
2146
+ {
2147
+ cursor = 5 ; // regresar al principio
2148
+ }
2149
+ lcd.setCursor (cursor, 0 );
2150
+ }
2151
+ if (digitalRead (Boton_Left) == LOW)
2152
+ {
2153
+ delay (boton_retardo); // esperar a estabilidad
2154
+ cursor = cursor - 1 ;
2155
+ if (cursor < 5 )
2156
+ {
2157
+ cursor = 13 ; // regresar al final
2158
+ }
2159
+ lcd.setCursor (cursor, 0 );
2160
+ }
2161
+ if (digitalRead (Boton_Up) == LOW)
2162
+ {
2163
+ delay (boton_retardo); // esperar a estabilidad
2164
+ lcd.print (" I" );
2165
+ lcd.setCursor (cursor, 0 );
2166
+ calcular_val = 1 ;
2167
+ calcular = 1 ;
2168
+ }
2169
+ if (digitalRead (Boton_Down) == LOW)
2170
+ {
2171
+ delay (boton_retardo); // esperar a estabilidad
2172
+ lcd.print (" O" );
2173
+ lcd.setCursor (cursor, 0 );
2174
+ calcular_val = 0 ;
2175
+ calcular = 1 ;
2176
+ }
2177
+ if (calcular == 1 )
2178
+ {
2179
+ calcular = 0 ;
2180
+ // agregar a la matriz el valor nuevo
2181
+ switch (cursor)
2182
+ {
2183
+ case 5 : // 1
2184
+ valor_Bin [1 ] = calcular_val;
2185
+ break ;
2186
+ case 6 : // 2
2187
+ valor_Bin [2 ] = calcular_val;
2188
+ break ;
2189
+ case 7 : // 4
2190
+ valor_Bin [3 ] = calcular_val;
2191
+ break ;
2192
+ case 8 : // 8
2193
+ valor_Bin [4 ] = calcular_val;
2194
+ break ;
2195
+ case 9 : // 16
2196
+ valor_Bin [5 ] = calcular_val;
2197
+ break ;
2198
+ case 10 : // 32
2199
+ valor_Bin [6 ] = calcular_val;
2200
+ break ;
2201
+ case 11 : // 64
2202
+ valor_Bin [7 ] = calcular_val;
2203
+ break ;
2204
+ case 12 : // 128
2205
+ valor_Bin [8 ] = calcular_val;
2206
+ break ;
2207
+ case 13 : // 256
2208
+ valor_Bin [9 ] = calcular_val;
2209
+ break ;
2210
+ }
2211
+ // calcular valor de binario a decimal
2212
+ valor = 0 ;
2213
+ if (valor_Bin [1 ] == 1 )
2214
+ {
2215
+ valor = valor + 1 ;
2216
+ }
2217
+ if (valor_Bin [2 ] == 1 )
2218
+ {
2219
+ valor = valor + 2 ;
2220
+ }
2221
+ if (valor_Bin [3 ] == 1 )
2222
+ {
2223
+ valor = valor + 4 ;
2224
+ }
2225
+ if (valor_Bin [4 ] == 1 )
2226
+ {
2227
+ valor = valor + 8 ;
2228
+ }
2229
+ if (valor_Bin [5 ] == 1 )
2230
+ {
2231
+ valor = valor + 16 ;
2232
+ }
2233
+ if (valor_Bin [6 ] == 1 )
2234
+ {
2235
+ valor = valor + 32 ;
2236
+ }
2237
+ if (valor_Bin [7 ] == 1 )
2238
+ {
2239
+ valor = valor + 64 ;
2240
+ }
2241
+ if (valor_Bin [8 ] == 1 )
2242
+ {
2243
+ valor = valor + 128 ;
2244
+ }
2245
+ if (valor_Bin [9 ] == 1 )
2246
+ {
2247
+ valor = valor + 256 ;
2248
+ }
2249
+ // escribir el valor en decimal
2250
+ Numerico_Write (valor, 5 , 3 );
2251
+ lcd.setCursor (cursor, 0 );
2252
+ }
2253
+ }
2254
+ delay (200 ); // esperar a estabilidad
2255
+ lcd.noBlink ();
2256
+ goto calc;
2257
+ }
2258
+ // Decimal a binario
2259
+ if (LCD_Col_Pos == 4 && LCD_Row_Pos == 3 )
2260
+ {
2261
+ Num_Row_Pos = 3 ;
2262
+ Num_Col_Pos = 5 ;
2263
+ Numerico_Calc (0 );
2264
+ if (Num_Val > 511 )
2265
+ {
2266
+ Num_Val = 511 ; // corregir valor en pantalla
2267
+ lcd.setCursor (5 , 3 );
2268
+ lcd.print (" 511" );
2269
+ }
2270
+ valor = Num_Val;
2271
+ // escribir 00000000 en el valor binario para borrar el anterior
2272
+ lcd.setCursor (5 , 0 );
2273
+ lcd.print (" OOOOOOOOO" );
2274
+ lcd.setCursor (5 , 0 );
2275
+ // calcular binario
2276
+ valor_temp = valor;
2277
+ for (byte pos = 9 ; pos >= 1 ; pos --)
2278
+ {
2279
+ valor_resto = valor_temp % 2 ;
2280
+ valor_temp = valor_temp / 2 ;
2281
+ valor_Bin [pos] = valor_resto;
2282
+ if (valor_resto == 0 )
2283
+ {
2284
+ lcd.print (" O" );
2285
+ }
2286
+ else
2287
+ {
2288
+ lcd.print (" I" );
2289
+ }
2290
+ }
2291
+ goto calc;
2292
+ }
2293
+ }
2294
+
2086
2295
void GUI_Config ()
2087
2296
{
2088
2297
Inicio:
@@ -2119,7 +2328,7 @@ void GUI_Config()
2119
2328
}
2120
2329
// Cursor
2121
2330
LCD_Col_Pos = 10 ; // posicion de cursor
2122
- LCD_Row_Pos = 1 ; // posicion e cursor
2331
+ LCD_Row_Pos = 1 ; // posicion de cursor
2123
2332
// configuracion de cursor
2124
2333
Cursor_Conf_Clear (); // limpiar array
2125
2334
// Cursores
@@ -2323,7 +2532,7 @@ void GUI_Control_Multiply()
2323
2532
lcd.print (Universo_Actual);
2324
2533
}
2325
2534
lcd.setCursor (0 , 1 );
2326
- lcd.print (" First CH Ctrl " );
2535
+ lcd.print (" First CH Exit " );
2327
2536
lcd.setCursor (0 , 2 );
2328
2537
lcd.print (" Multiply Memory" );
2329
2538
lcd.setCursor (0 , 3 );
@@ -2349,7 +2558,7 @@ void GUI_Control_Multiply()
2349
2558
// navegar
2350
2559
GUI_Navegar (0 , 0 );
2351
2560
// Acciones
2352
- // Control
2561
+ // Exit
2353
2562
if (LCD_Col_Pos == 13 && LCD_Row_Pos == 1 )
2354
2563
{
2355
2564
GUI_Control_Options ();
@@ -2490,7 +2699,7 @@ void GUI_Control_Chaser()
2490
2699
lcd.setCursor (3 , 1 );
2491
2700
lcd.print (" Delay x10=mS" );
2492
2701
lcd.setCursor (0 , 2 );
2493
- lcd.print (" First CH Ctrl " );
2702
+ lcd.print (" First CH Exit " );
2494
2703
lcd.setCursor (0 , 3 );
2495
2704
lcd.print (" Final CH Start" );
2496
2705
Numerico_Write (Delay , 9 , 1 );
@@ -2621,7 +2830,7 @@ void GUI_Control_Chaser()
2621
2830
2622
2831
void Numerico_Write (int valor, int col, int row)
2623
2832
{
2624
- // posicionar el valor en los campos 000
2833
+ // posicionar el valor en los campos 000
2625
2834
lcd.setCursor (col, row);
2626
2835
lcd.print (" 000" );
2627
2836
if (valor < 10 )
@@ -2656,7 +2865,7 @@ void GUI_Control_Unit()
2656
2865
lcd.print (Universo_Actual);
2657
2866
}
2658
2867
lcd.setCursor (14 , 2 );
2659
- lcd.print (" Ctrl " );
2868
+ lcd.print (" Exit " );
2660
2869
lcd.setCursor (14 , 3 );
2661
2870
lcd.print (" Memory" );
2662
2871
lcd.setCursor (0 , 2 );
0 commit comments