Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // There are 8 grids for 4 directions and 1 reversal
- const uint16_t TubaGridLeft[] = {
- 9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,10,9,8,7,6,5,4,3,2,1,0,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,9999,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,9999,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,152,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124,9999,9999,9999,9999,
- 9999,9999,9999,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,9999,9999,9999,
- 9999,9999,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,9999,9999,
- 9999,9999,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,9999,9999,
- 9999,284,283,282,281,280,279,278,277,276,275,274,273,272,271,270,269,268,267,266,265,264,263,262,261,260,259,258,257,256,255,254,253,252,251,250,9999,
- 9999,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,9999,
- 9999,354,353,352,351,350,349,348,347,346,345,344,343,342,341,340,339,338,337,336,335,334,333,332,331,330,329,328,327,326,325,324,323,322,321,320,9999,
- 355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,
- 428,427,426,425,424,423,422,421,420,419,418,417,416,415,414,413,412,411,410,409,408,407,406,405,404,403,402,401,400,399,398,397,396,395,394,393,392,
- 429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,
- 502,501,500,499,498,497,496,495,494,493,492,491,490,489,488,487,486,485,484,483,482,481,480,479,478,477,476,475,474,473,472,471,470,469,468,467,466,
- 503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,
- 576,575,574,573,572,571,570,569,568,567,566,565,564,563,562,561,560,559,558,557,556,555,554,553,552,551,550,549,548,547,546,545,544,543,542,541,540,
- 577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,
- 650,649,648,647,646,645,644,643,642,641,640,639,638,637,636,635,634,633,632,631,630,629,628,627,626,625,624,623,622,621,620,619,618,617,616,615,614,
- 651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,
- 724,723,722,721,720,719,718,717,716,715,714,713,712,711,710,709,708,707,706,705,704,703,702,701,700,699,698,697,696,695,694,693,692,691,690,689,688,
- 725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,
- 9999,796,795,794,793,792,791,790,789,788,787,786,785,784,783,782,781,780,779,778,777,776,775,774,773,772,771,770,769,768,767,766,765,764,763,762,9999,
- 9999,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,9999,
- 9999,866,865,864,863,862,861,860,859,858,857,856,855,854,853,852,851,850,849,848,847,846,845,844,843,842,841,840,839,838,837,836,835,834,833,832,9999,
- 9999,9999,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,9999,9999,
- 9999,9999,932,931,930,929,928,927,926,925,924,923,922,921,920,919,918,917,916,915,914,913,912,911,910,909,908,907,906,905,904,903,902,901,900,9999,9999,
- 9999,9999,9999,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,9999,9999,9999,
- 9999,9999,9999,9999,992,991,990,989,988,987,986,985,984,983,982,981,980,979,978,977,976,975,974,973,972,971,970,969,968,967,966,965,964,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,1044,1043,1042,1041,1040,1039,1038,1037,1036,1035,1034,1033,1032,1031,1030,1029,1028,1027,1026,1025,1024,1023,1022,1021,1020,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,9999,1088,1087,1086,1085,1084,1083,1082,1081,1080,1079,1078,1077,1076,1075,1074,1073,1072,1071,1070,1069,1068,9999,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,1116,1115,1114,1113,1112,1111,1110,1109,1108,1107,1106,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,9999,
- };
- //-----------------------------------------------------------------------------------------------------------------------------------
- // iDir is set with a button
- //----------------------------
- uint16_t XY(uint8_t x, uint8_t y) {
- static int iDir = 1;
- switch(iDir){
- case 1: return TubaGridLeft[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 3: return TubaGridUp[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 2: return TubaGridRight[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 4: return TubaGridDown[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 5: return TubaGridDiagLeft[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 7: return TubaGridDiagUp[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 6: return TubaGridDiagRight[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- case 8: return TubaGridDiagDown[constrain(y * 37 + x, 0, (37 * 37)-1)]; break;
- default:
- iDir = 1;
- return(XY(x,y));
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment